I am using Ubuntu-15.10 wily, Apache-2.4.12

I've been trying to use ProxyPass in an SSL enabled VirtualHost like so:

ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
    Require all granted
ProxyPass /myapp/
ProxyPassReverse /myapp/

With above configuration, I assumed that whatever is being served by the server on that port, e.g. web will be appended to https://www.example.com/myapp/web.

However, this is not what I get. In Apache logs I get:

... File does not exist: /var/www/html/web, referer: https://www.example.com/myapp/

Is this because I don't understand what ProxyPass is supposed to do? Or is there something wrong with my configuration that I need to correct?

ADDENDUM (18 Feb 2016)

I have turned on logging for mod_proxy and I see the following which doesn't make sense:

... connecting to
... connected / to
... fam 2 socket created to
... connection established with (
... connection complete to (
... http: has released connection for (
... proxy: connection shutdown

I am assuming that one of the addresses in the first line is the intrnal placeholder and the other is the URL being retrieved. But why in the second line the retrieved url gets connected to / instead of /myapp/ as per ProxyPass?

  • And the third alternative is that your reverse proxy is configured correctly but that it is that doesn't display the correct content and returns a 404... – HBruijn Feb 17 '16 at 10:10
  • I have tried to reach the server with the local IP, and it works fine. I know that the server is properly working since it is on the root of the URL, so it is the one returning the web part. – ismail Feb 17 '16 at 10:32

I found a solution, but it is not what I hoped for nor what I expected from my readings on ProxyPass. It might be a mistake on my part, or the documentation is not as clear as it should be. ProxyPass can not append proxied URL to a path of an invented name. So, I had to make my application load from a directory on the designated port rather than from the root of the URL as such:

ProxyPass /myapp
ProxyPassReverse /myapp

Furthermore, A RewriteRule must be used as well if there are resources that need to be loaded, e.g. queries, images, scripts, etc.

The Rewrite rules would be:

RewriteEngine On
RewriteRule ^(.*)$1 [P,L]

I feel like there are many other solution that might involve other proxy modules and possibly RewriteRule, however, this is the one that is as simple as my knowledge in apache got.

So, the bottom-line, at least the first component of the path must be present on both ends in order for ProxyPass to do it's job. I can not use ProxyPath to load on a path I make up without further complications in proxy settings.

I hope someone finds this answer of help.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.