On 08.10.2019 00:50, Magosányi Árpád wrote:
On 10/7/19 11:29 PM, André Warnier (tomcat) wrote:
<LocationMatch /servlet.*>
     DirectoryIndex off
     RewriteEngine Off
     AuthType openid-connect
     AllowOverride None
     AuthzDBDQuery "a correct database query"
     Require dbd-group allrepo
     LogLevel debug
</LocationMatch>

Nice. It have solved the problem, thank you very much. By adding the ssl
related directives here I could pass the ssl info as well. So basically
we have put the JkMount in a Location, and the other directives in
another similar directive, as a kind of workaround?

Think of it as follows :
When httpd gets a request,
- step 1 : it first looks only at the request URL, and it applies any directives that it finds in <Location> or <LocationMatch> sections which match that URL. - step 2 : then it tries to match the URL, with the filesystem on disk, and IF it finds a file that corresponds to that URL
- step 3 : then it applies any <Directory(Match)> or <Files(Match)> that apply 
to that file
- step 4 : httpd serves the file back to the browser

If you have JkMount directives that match the URL, then step 2, 3 and 4 above never happen, because the request will be passed to tomcat anyway, so it will never map to a file on the httpd filesystem. And if you have JkUnmount directives, that also match the URL, then they partially negate the matching JkMount, and they /force/ step 2, 3 and 4.

The combination of JkMount/JkUnmount directives, with the httpd <Location(Match)> and <Directory(Match)> sections, is sometimes a bit unclear, specially when they overlap.

There is another syntax applicable to the proxying via mod_jk, which I prefer because I find that it makes the httpd URL mapping clearer, in a httpd configuration logic sense.
You can find it here :
http://tomcat.apache.org/connectors-doc/reference/apache.html
section : Using SetHandler and Environment Variables

Using that form, you do NOT use any "JkMount/JkUnmount" directives, you use only <Location(Match)> blocks, like :

<LocationMatch /servlet.*>
      SetHandler jakarta-servlet
      SetEnv JK_WORKER_NAME worker1
      DirectoryIndex off
      RewriteEngine Off
      AuthType openid-connect
      AllowOverride None
      AuthzDBDQuery "a correct database query"
      Require dbd-group allrepo
      LogLevel debug
</LocationMatch>

The combination of the <LocationMatch /servlet.*>, SetHandler and SetEnv, does the same as a separate "JkMount /servlet* worker1" and (in my view) it makes it clearer in the Apache httpd configuration file, to know which URLs get proxied to tomcat and which do not get proxied. Look at the example "<Location /apps/>" to see how you can have some static documents served by the httpd front-end directly (= not proxied to tomcat), and the real calls to tomcat servlets being proxied to tomcat.






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to