Precedence of Apache <Location> directives?

Viewed 243

We are using Apache 2.4.48 and a module that Oracle provides (the "WebLogic Plugin for Apache" - I guess equivalent to ProxyPass/ProxyPassReverse, but more WebLogic specific) to proxy some endpoints that are on WebLogic server. The configuration was setup awhile ago, and I am trying to understand the behavior of the directive.

In the Apache ssl.conf, we have (for example):

<VirtualHost _default_:443 _default_:14101>

<Location />
  WLSRequest On
  SetHandler weblogic-handler
  WebLogicCluster XXX01.foo.com:14101,XXX02.foo.com:14101,XXX03.foo.com:14101,XXX04.foo.com:14101
  WLCookieName OAMSESSIONID
  SecureProxy ON
  WLSSLWallet "/apps/products/apache/2.4.46/instances/apache_oam/conf/certs/wallet"
  #RequireSSLHostMatch false
  Debug OFF
  WLLogFile "/apps/products/apache/2.4.46/instances/apache_oam/logs/oam_location.out"
</Location>

<Location /service/show>
  SetHandler default-handler
  WLSRequest Off
  AuthType None
  Require all granted
  Header always set Access-Control-Allow-Origin %{ACAO}e env=ACAO
  Header always set Access-Control-Allow-Credentials "true"
  Header always set Access-Control-Allow-Methods "GET, POST, OPTIONS"
  Header always set Access-Control-Allow-Headers "Origin, Content-Type, Accept, Authorization"
</Location>
.
.
.
### Cert Check ###
ScriptAlias /certcheck "/apps/products/apache/instances/apache_oam/cgi-bin/certcheck"
<Location /certcheck>
  SSLVerifyClient optional_no_ca
</Location>
### End Cert Check ###

</VirtualHost>

I (probably mistakenly) always thought that, in Apache configuration, the more specific directive would take precedence over the less specific, but, when I test with the above, the

<Location /> 

appears to cause EVERY request to be proxied to the backend servers, even though the "<Location /certcheck>" is "more specific".

Because of this, the /certcheck, which is supposed to be a local resource, is causing the request to be proxied to the backend, instead of serving from the local resource.

Can someone explain why this is happening?

Also, if what we WANTED was to proxy every request/URI UNLESS we specify the URI in a "<Location /xxxx>", how can we accomplish this?

Thanks, Jim

0 Answers
Related