Before this change, typing takes me to the Tomcat administration page; after it, I get '503 Service Unavailable'. I've temporarily turned off my firewall and removed AppArmor. Here's the relevant portion of modjk.log.
- Apache 503 Error
- Apache Reverse Proxy 503 Service Unavailable Due
- Apache Reverse Proxy 503 Service Unavailable Free
- Apache Reverse Proxy 503 Service Unavailable
In this article, we are going to configure Apache as a reverse proxy to wildfly through mod_proxy module.
Outline of the setup is shown below.
This setup assumes that we have Apache and 2 standalone instances of Wildfly running.
Apache side config changes
1. Mod_Proxy module comes in-built with other Apache modules. Add/uncomment the below lines in $APACHE_HOME/conf/httpd.conf
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
2. Add below lines to the end of $APACHE_HOME/conf/httpd.conf
Proxypass /server1/ http://localhost:8080/
ProxypassReverse /server1/ http://localhost:8080/
Proxypass /server2/ http://localhost:8280/
ProxypassReverse /server2/ http://localhost:8280/
3. Restart Apache service.
E:Apache Web serverApache24bin>net stop apache2.4
The Apache2.4 service is stopping.
The Apache2.4 service was stopped successfully.
Looking at the RFC does not seem to explicitly state that a 503 cannot be cached. A response received with a status code of 200, 203, 206, 300, 301 or 410 MAY be stored by a cache and used in reply to a subsequent request, subject to the expiration mechanism, unless a cache-control directive prohibits caching. I am not sure this is what you really want: with your current config, the steps that follow after you open localhost:8080 are: 1. The local socket to 8080 is connected to the proxy container port 80 2. The proxy container proxies back to host on port 8001 (172.17.42.1 is the gateway of the docker network, ie. It is same host as localhost) 3. Port 8001 on the host is connected to the cicd.
Apache 503 Error
E:Apache Web serverApache24bin>net start apache2.4
The Apache2.4 service is starting.
The Apache2.4 service was started successfully.
Apache Reverse Proxy 503 Service Unavailable Due
Wildfly side config changes
Apache Reverse Proxy 503 Service Unavailable Free
No change needed to Wildfly configuration. By default, undertow subsystem provides http connector.
<subsystem xmlns=”urn:jboss:domain:undertow:1.2″>
<buffer-cache name=”default”/>
<server name=”default-server”>
<http-listener name=”default” socket-binding=”http”/>
<host name=”default-host” alias=”localhost”>
Apache Reverse Proxy 503 Service Unavailable
TESTING
Now browse http://localhost/server1 and http://localhost/server2. The default wildfly page gets displayed. Try to shutdown first wildfly instance and you will see 503 Service Unavailable error on the browser for http://localhost/server1.