Home ProxyPass / ProxyPassReverse vs. simple RewriteRule
Reply: 0

ProxyPass / ProxyPassReverse vs. simple RewriteRule

Basj
1#
Basj Published in 2018-02-13 13:33:32Z

I'd like to redirect traffic from http://198.51.100.13/site1/ to the server's port 1001.

  1. This works (but don't forget to a2enmod proxy and a2enmod proxy_http first!):

    RewriteEngine On
    RewriteRule ^/site1(.*)$ http://localhost:1001$1 [P,L]
    
  2. I have read that it should be possible to do it that way, instead of using RewriteRule:

    ProxyPass /site1 http://localhost:1001/
    ProxyPassReverse /site1 http://localhost:1001/
    

However, it doesn't work for me for now (Proxy Error, The proxy server received an invalid response from an upstream server. The proxy server could not handle the request GET /site1. Reason: DNS lookup failure for: localhost:1001site1).

Question: What's the benefit of solution 2 instead of simple URL rewriting (solution 1)? and how to correct solution 2 to make it work?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.302877 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO