Play WS Proxy Authentication Required

1.1k Views Asked by At

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

There are 1 best solutions below

1
On

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.