Getting 302 error when accessing post operations via camel http4

Solution Unverified - Updated -

Issue

  • I am using camel-http4 component to call api which is configured in redhat 3scale environment like below.
.toD("http4://zyx/rest/abc/v1")

And I am getting below exception when trying to access HTTP post methods , HTTP get methods working fine.

CaughtExceptionType: org.apache.camel.http.common.HttpOperationFailedException, CaughtExceptionMessage: HTTP operation failed invoking http://zyx/rest/abc/v1/ with statusCode: 302, redirectLocation: https://zyx/rest/abc/v1/, StackTrace: org.apache.camel.http.common.HttpOperationFailedException: 

I think the reason is in HTTP4 the redirect is not automatically followed. How to enable redirection in camel-http4

I tried

    .toD("http4://zyx/rest/abc/v1?httpClient.handleRedirects=true")

But getting the error

CaughtExceptionType: org.apache.camel.ResolveEndpointFailedException, CaughtExceptionMessage: Failed to resolve endpoint: http4://zyx/rest/abc/v1?httpClient.handleRedirects=true 

Environment

  • OCP
    • 3.11
  • Camel

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content