2

I'm trying to make a WS call using the play framework behind a corporate proxy. Currently I have my http.proxyHost(user,pass,port) parameters in the build.bat file. I can make a URL connection to the desired external url but when trying to use Play's WS api I'm getting a 407 authentication required error. I've tried removing the proxy authentication parameters from the build.bat and placing the parameters in the application.conf file but that made no difference.

    final Promise<Result> result = WS.url(endpoint).get().map(
            new Function<WS.Response, Result>() {
                public Result apply(WS.Response response) {
                    return ok(response.getStatus() + " " + response.getBody() + " " + response.getStatusText());
                }
            }
    );

UPDATE: While debugging I took a look at the values in the configuration object and everything seems to be set. Confused as to why I'm still getting authentication issues...

Play.application().configuration().getString("http.proxyHost")
Play.application().configuration().getString("http.proxyPort")
Play.application().configuration().getString("http.proxyUser")
Play.application().configuration().getString("http.proxyPassword")

1 Answers1

-1

I don't know why, but setting ws.useProxyProperties=false seemed to work. I would think the application would need to use the Proxy properties from the build file, but seems like it doesn't.

  • Wrong solution, it just disable using proxy at all. But it seems play ws api (or AsyncHttpClient) as issues following 407 responses sent by the configred proxy or use http auth straight in first call – Benoit Nov 08 '16 at 14:37