HTTP proxy problem

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

HTTP proxy problem

Ron Cecchini
Hi, all.

I have previously successfully used the HTTP component with proxy info to poll a site.

Bu now I'm running into a "connection reset" problem when polling another site that has a slightly different connection strategy.

----------------------------------------

The HTTP configuration for the first site was totally straight-forward:

    url.full = https://bar.com/query?<query-params>

    proxy.params = authenticationPreemptive=true
        &authMethod=Basic&proxyAuthScheme=http
        &authUsername=<user>&authPassword=<password>
        &proxyAuthHost=<proxy-host>&proxyAuthPort=<proxy-port>

and I was able to simply put the following in a timer route:

    .to("{{url.full}}&{{proxy.params}}")

----------------------------------------

The second site requires a two-step login where you create an HTTP connection to:

    https://www.<company>/ajaxauth/login

and then send the credentials and query together to the same HTTP connection:

    identity=<user>&password=<password>&query=https://<query>

You can combine both steps into a single command.  For example, in curl this works:

    % curl https://www.<company>/ajaxauth/login -d 'identity=<user>&password=<password>&query=https://<query>'

And in fact, in a non-proxy environment, I was able to successfully poll the endpoint in Camel doing:

    url.login = https://www.<company>/ajaxauth/login
    url.post  = identity=<user>&password=<password>&query=https://<query>

and putting this in my timer route:

    .setHeader(Exchange.CONTENT_TYPE, constant("application/x-www-form-urlencoded"))
    .setHeader(Exchange.HTTP_METHOD,  constant("POST"))
    .setBody(simple("{{url.post}}"))   // makes the HTTP call a POST
    .to("{{url.login}}")

----------------------------------------

But in a proxy environment, the second route no longer works.

With proxy info set to:

    proxy.params = authenticationPreemptive=true
        &authMethod={{proxy.method}}&proxyAuthScheme={{proxy.scheme}}
        &proxyAuthHost={{proxy.host}}&proxyAuthPort={{proxy.port}}

I tried several combinations of where to put the proxy info; for example:

//    .setBody(simple("{{url.post}}"))  // makes the HTTP call a POST
    .setBody(simple("{{url.post}}&{{proxy.params}}"))  // makes the HTTP call a POST
    .to("{{url.login}}&{{proxy.params}}")

but nothing worked.  Everything throws a java.net.SocketException: Connection reset.

I tried some other stuff, like setting the several "timeout" HTTP component parameters to 0 to make them infinite timeouts, but that didn't work either.

Thanks for any help.