0

I have inherited a system and there are a few things that no one knows why there are how there are anymore.

In the httpd configuration, I've come across a few occurrences of Location directives that match all paths:

<Location />
    ProxyPass http://localhost:4500/ retry=1 acquire=3000 timeout=600 Keepalive=On
    ProxyPassReverse http://localhost:4500/
</Location>

Isn't the above just equivalent to not having the Location directive?

    ProxyPass "/" http://localhost:4500/ retry=1 acquire=3000 timeout=600 Keepalive=On
    ProxyPassReverse "/" http://localhost:4500/

Is there any advantage of the first over the second?

garci560
  • 101
  • 1
  • 3
  • when using proxypass directives it is "clearer" to have them defined without location, generally placing them inside Location confuse the hell of a lot of people, but both examples you have shown are equally correct. – Daniel Ferradal Mar 29 '17 at 14:04
  • This is just a guess, but in the first case you could and some requirements like allow only from localhost or other ip. – nck Nov 24 '21 at 15:24

1 Answers1

0

There is no difference between the two cases. You can define your config in either way. I can see only a difference in port numbers and acquire parameter (I don't think you are asking about them).

You can also remove the slashes / to read:

ProxyPass http://localhost:3000/ retry=1 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse http://localhost:3000/
Khaled
  • 36,533
  • 8
  • 72
  • 99
  • Sorry, that with the `port` and `acquire` was a typo, I've edited it. But I think I need the slashes when not using `Location`, otherwise `apachectl -t` complains "ProxyPass|ProxyPassMatch needs a path when not defined in a location" – garci560 Mar 29 '17 at 14:09
  • @nprensen: The path is optional as stated in apache documentation. – Khaled Mar 29 '17 at 14:18
  • Yes, but it also says "When used inside a section, the first argument is omitted and the local directory is obtained from the .". And I do get that error when I omit it and I use no Location – garci560 Mar 29 '17 at 14:42