0

I have apache running on below reverse proxy config to serve java webapp content

<VirtualHost *:80>
SSLProxyEngine on
ProxyPreserveHost On
ProxyRequests Off

ServerName www.example.com
ServerAlias example.com

<Location />
        Order deny,allow
        Allow from all
        SetOutputFilter INFLATE;DEFLATE

        ProxyPass  http://localhost:7070/
        ProxyPassReverse  http://localhost:7070/
        AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
</Location>

</VirtualHost>

Now i want to add static file folder and should be served under the same same domain name but under "/auth" path https://example.com/auth

so i added below config just below the above

<Location /auth>
      Require all granted
      Allow from all
</Location>

Alias "/auth" "/var/www/html/auth"
DocumentRoot /var/www/html/auth/
<Directory /var/www/html/auth>
        Require all granted
        DirectoryIndex index.html
</Directory>

But when i try "https://example.com/auth" it still goes to java webapp and gives me 404. But when i curl localhost i can see webpage content

curl http://localhost

how to access static content on /var/www/html/auth/ using https://example.com/auth URL

1 Answer 1

1

You need to explicitly remove that location from the proxy by using the ProxyPass "!" directive. This should be done in the Location what you don't need to be proxyed, and this block should be written after the proxy block, like this:

<Location />
  ProxyPass http://localhost:7070/
  (...)
</Location>

<Location /auth>
  ProxyPass "!"
</Location>
1
  • Thanks mate. This worked like a charm Jan 8, 2021 at 3:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .