Brutus
Brutus

Reputation: 790

Wildfly - Proxy Configuration

I just need to configure Wildfly 8 to use an external HTTP Proxy in order to connect to the Internet; can you tell me where and how to specify proxy address and port?

I'm running Wildfly as a service on Windows 7.

Thank you very much for your help!

Upvotes: 0

Views: 13829

Answers (2)

cghislai
cghislai

Reputation: 1801

We had to go through a few more steps using Wildfly 10:

  • Overwrite the resteasy-client module in the wildfly layers so that it does not register itself as the default JAX-rs client builder. This is required because jboss will scan its own modules before the ones in our entreprise archive. We added an exclusion in the module.xml:

```

<resource-root path="resteasy-client-3.0.19.Final.jar">
    <filter>
      <exclude-set>
          <path name="META-INF/services"/>
      </exclude-set>
    </filter>
 </resource-root>

```

  • Implements your own ResteasyClientBuilder to make it use its URLConnection engine. We found out that the default engine (apache http commons) did not honor our http.proxyHost system properties, whereas the java URLConnection engine did.

```

public class ProxifiedClientBuilder extends ResteasyClientBuilder {
    public ProxifiedClientBuilder() {
        super();
        URLConnectionEngine urlConnectionEngine = new URLConnectionEngine();
        httpEngine(urlConnectionEngine);
  }
}

```

  • Register your ClientBuilder as the default provider. You can do that in a META-INF/services file or using a system property:

```

<system-properties>
 <property name="javax.ws.rs.client.ClientBuilder" value="be.buyway.util.ProxifiedClientBuilder"/>
</system-properties>   

```

Hope this helps someone else.

Upvotes: 0

Yury Shaban
Yury Shaban

Reputation: 105

I did it by adding

set "JAVA_OPTS=%JAVA_OPTS% -Dhttp.proxyHost=MY_PROXY_HOST -Dhttp.proxyPort=MY_PROXY_PORT -Dhttp.proxyUser=MY_LOGIN -Dhttp.proxyPassword=MY_PASSWORD"

into file bin/standalone.conf.bat (I'm using wildfly in the standalone mode) In other words, Wildfly uses system (JVM) proxy settings well.

Upvotes: 2

Related Questions