62

I wanted to reverse proxy a web service from my tomcat server using apache web server. I have modified the httpd.conf

LoadModule proxy_module modules/mod_proxy.so

<Directory />
    AllowOverride none
    Require all denied
</Directory>

ProxyPass         /ROOT  http://localhost:8080/ROOT
ProxyPassReverse  /ROOT  http://localhost:8080/ROOT

My Tomcat server runs on port 8080, now when I run localhost/ROOT, I get error 500 internal server error.

This last entry in the error_log is:

[Thu Jul 04 14:17:00.097359 2013] [proxy:warn] [pid 18980:tid 4476780544] [client 127.0.0.1:50525] AH01144: No protocol handler was valid for the URL /ROOT. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
The last entry in the access_log is:
 127.0.0.1 - - [04/Jul/2013:14:17:00 -0400] "GET /ROOT HTTP/1.1" 500 528

Any idea on what I am doing wrong here?

5
  • ProxyPassReverse localhost:8080/ROOT /ROOT Commented Jul 4, 2013 at 17:25
  • Any logs in the logs\access.log? Commented Jul 4, 2013 at 18:00
  • Hey, so that did not work, this is how httpd.conf looks like LoadModule proxy_module modules/mod_proxy.so <Directory /> AllowOverride none Require all denied </Directory> ProxyPass /ROOT localhost:8080/ROOT ProxyPassReverse localhost:8080/ROOT /ROOT Commented Jul 4, 2013 at 18:18
  • See also superuser.com/questions/439054/… Commented May 22, 2015 at 15:01
  • See also serverfault.com/questions/242650/… Commented May 22, 2015 at 15:01

3 Answers 3

99

So it took some time but I figured out the way to do it. There is one more module which needs to be loaded. This is what the httpd.conf looks like

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

<Directory />
    AllowOverride none
    Require all denied
</Directory>

ProxyPass         /ROOT  http://localhost:8080/ROOT
ProxyPassReverse  /ROOT  http://localhost:8080/ROOT

This works for sure. :)

Sign up to request clarification or add additional context in comments.

3 Comments

sudo a2enmod proxy sudo a2enmod proxy_http sudo service apache2 restart
THIS proxy_http is required!
Coming from a world where I used mod_proxy and mod_proxy_ajp for YEARS, you need to replace ajp with the http module in non-java configurations. The clue is this error in the Apache logs: AH01144: No protocol handler was valid for the URL
68

Since it's easy to overlook, pay attention to @muka's comment:

sudo a2enmod proxy  
sudo a2enmod proxy_http  
sudo service apache2 restart

Make sure to enable both modules proxy and proxy_http!

Comments

17

In addition to the other fine answers, if you're proxying to an https endpoint, you need to enable mod_ssl and add SSLProxyEngine on to your vhost

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.