Hi I created a ticket https://issues.apache.org/jira/browse/HTTPCLIENT-2390
On Sat, Aug 23, 2025 at 8:22 AM Claus Ibsen <claus.ib...@gmail.com> wrote: > Hi > > Looking inside the HTTP client source code, then it looks like its not > possible. > > > org/apache/httpcomponents/client5/httpclient5/5.4.4/httpclient5-5.4.4-sources.jar!/org/apache/hc/client5/http/impl/async/AsyncRedirectExec.java:149 > > There it detects that its a 301/302 and if its a POST then change that to > a GET > And there is no way to influence this, with a custom > RedirectStrategy implementation. > > So I think your best way is to ask the HTTP client project to see if they > can improve this, and maybe have a some API or new option you can set to > control this. > > > > > > > > On Sat, Aug 23, 2025 at 8:15 AM Claus Ibsen <claus.ib...@gmail.com> wrote: > >> Hi >> >> Ah okay yeah that is a special case. But it's not really a bug in Camel >> as you mention it should be using 308 instead. >> Yeah I think not many humans know about this and systems may be hardcoded >> to use 301. >> >> So if anything then its something in HTTP client that should have some >> option to "overrule" this 301 and treat it as a 308. >> >> >> >> On Wed, Aug 20, 2025 at 9:33 PM Chirag <chirag.sangh...@gmail.com> wrote: >> >>> it is v2: >>> rest("/v2/swapi-graphql/all-films").get() >>> .produces("application/json") >>> .to("direct:swapi-graphql-all-films2"); >>> from("direct:swapi-graphql-all-films2") >>> .setBody(constant("{ allFilms { films { title director releaseDate } } >>> }")) >>> .to("graphql:// >>> https://swapi-graphql.netlify.app/.netlify/functions/index") >>> .convertBodyTo(String.class); >>> The reason for the failure is interesting: >>> 1. GraphQL component constructs POST and invokes HTTP >>> 2. netlify's index URL returns 301 with /graphql - and that forces POST >>> to >>> be changed to GET by underlying http client. >>> >>> looking at HTTP spec - it should have been 308 >>> https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/308 - >>> but haven't seen 308 adopted widely. >>> >>> ચિરાગ/चिराग/Chirag >>> ------------------------------------------ >>> Sent from My Gmail Account >>> >>> >>> On Wed, Aug 20, 2025 at 3:18 PM Claus Ibsen <claus.ib...@gmail.com> >>> wrote: >>> >>> > Hi >>> > >>> > Can you tell if its v1 or v2 in that sample code that fails (due to a >>> > redirect) >>> > >>> > On Tue, Aug 19, 2025 at 12:09 AM Chirag <w35ank...@mozmail.com.invalid >>> > >>> > wrote: >>> > >>> > > Picking up a thread from Linkedin Discussion >>> > > >>> > > >>> > > >>> > >>> https://www.linkedin.com/posts/diego-giudici-2a4a82183_apache-camel-exec-component-to-be-used-to-activity-7361417086029520896-rX9S?utm_source=share&utm_medium=member_desktop&rcm=ACoAAAADB-oBkocmID4JNAjX2CC91jH5a8sV5l4 >>> > > >>> > > here is route: >>> > > >>> https://gist.github.com/chiragsanghavi/b83ef5babc6d02b2757ae6a9cd100281 >>> > > >>> > > Technically this is not a bug, as site >>> > > https://swapi-graphql.netlify.app/.netlify/functions/index leads to >>> a >>> > > direct, which shouldn't happen in real life. >>> > > >>> > > GraphGL component initiates request using a POST, but redirect is >>> handled >>> > > by Apache Common HTTP Client - and as GET - which is where the >>> "query" is >>> > > not passed to the redirected URL. >>> > > >>> > > what will be better way to handle it ? Should such scenario be >>> handled by >>> > > passing a custom http client that disables redirect and capture >>> error? >>> > > >>> > > If GraphQL component was built using camel-http underneath - it could >>> > > return many more values to make some decisions after exchange is >>> called >>> > . >>> > > >>> > >>> > >>> > -- >>> > Claus Ibsen >>> > >>> >> >> >> -- >> Claus Ibsen >> > > > -- > Claus Ibsen > -- Claus Ibsen