1

I'm running Apache 2.4 on Linux. I have a working .htaccess file.

As a test I'm doing the redirecting /ws/xyz123 to https://www.google.com.

So I request http://example.com/ws/xyz123 and I get redirected correctly to google.

The problem arises when I put in a reverse proxy for the /ws directory as follows:

ProxyPass        /ws http://192.168.25.2:7003/ws retry=0
ProxyPassReverse /ws http://192.168.25.2:7003/ws

The proxying works fine but the .htaccess is now ignored. If I comment out the proxy lines the .htaccess is back working again. I need both working. Is there a way to allow the .htaccess work with the proxy in place.

1 Answer 1

0

The ProxyPass /ws http://192.168.25.2:7003/ws is just an alternative syntax for the ProxyPass, equivalent to

<Location "/ws">
    ProxyPass "http://192.168.25.2:7003/ws"
</Location>

When you use the mod_proxy inside <Location>, Apache never looks into the directory (with the same path relative to DocumentRoot), omitting all the directives in your .htaccess file.

You should move the directives to your server configuration i.e. use them in <Location> or <VirtualHost> contexts instead of .htaccess context.

4
  • The issue here is as follows, I am modifying the htaccess to prevent access at certain times to /ws/x then maybe /ws/y (all generated automatically) Jun 29, 2018 at 8:51
  • You can't. Just move the directives to a context from where they are applied. Jun 29, 2018 at 12:33
  • So there is no way to use the htaccess for this scenario Jun 29, 2018 at 14:37
  • No way... and no need. I already explained, why. Jun 29, 2018 at 15:02

You must log in to answer this question.

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