This isn't a Linux/UNIX specific question, so my apologies; though the system involved is OpenSUSE 42.2.
I'm trying to understand how Apache handles URL rewriting for reverse proxy setups. In my test case, I've got Apache and Tomcat installed, straight off OpenSUSE's package repository. My only modification to Tomcat was sticking a sample .war file into its webapps directory; my only modification to Apache was allowing browsing to '/' and adding the proxy settings. On Apache, the DocumentRoot contains an index.html file only; on Tomcat, the equivalent location contains the 'sample' directory. Apache is on port 80, Tomcat on 8080. If I set up the proxy settings like the following: ProxyPass /sample http://localhost:8080/sample ProxyPassReverse /sample http://localhost:8080/sample Everything works as expected; I browse to http://localhost/sample, and the Tomcat sample webapp is displayed. But... If I make the following minor change to the proxy settings: ProxyPass /zample http://localhost:8080/sample ProxyPassReverse /zample http://localhost:8080/sample (note the 'z' -- 'zample' not 'sample' in the proxy path) and then browse to http://localhost/zample, I get an Apache 404 error. If I browse to http://localhost/zample/ (with the final slash) it works. Why the difference in behavior? I've tried every possible combination of putting, or not putting, trailing slashes in the URLs in the proxy settings. Reading the Apache documentation, it sounds as though this might have done the trick, but it didn't. It doesn't change the behavior at all. One thing in particular that seems weird is that apache access log entries generated when I get the 404 error when browsing to http://localhost/zample are: ::1 - - [23/Sep/2017:15:39:52 -0500] "GET /zample HTTP/1.1" 302 - "-" ::1 - - [23/Sep/2017:15:39:52 -0500] "GET /sample/ HTTP/1.1" 404 981 "- " as though Apache is trying to find the remote path (/sample) on the local DocumentRoot. Conversely, when browsing to http://localhost/zamp le/, the log entries are: ::1 - - [23/Sep/2017:15:36:46 -0500] "GET /zample/ HTTP/1.1" 200 636 "- " ::1 - - [23/Sep/2017:15:36:46 -0500] "GET /zample/images/tomcat.gif HTTP/1.1" 200 1441 "http://localhost/zample/" (works as expected) and when browsing to http://localhost/sample (no trailing slash!): ::1 - - [23/Sep/2017:16:13:20 -0500] "GET /sample HTTP/1.1" 302 - "-" ::1 - - [23/Sep/2017:16:13:20 -0500] "GET /sample/ HTTP/1.1" 200 636 "- " ::1 - - [23/Sep/2017:16:13:20 -0500] "GET /sample/images/tomcat.gif HTTP/1.1" 200 1441 "http://localhost/sample/" (this also works) To summarize: if the local path element matches the last element of the remote path, I can browse to a proxied URL either with or without a trailing slash; but if the local path element does not match the last element of the remote path, I *must* provide the trailing slash for the URL to resolve. Does anybody know why this is? Is there a way to get apache to treat the URLs consistently? What's a good resource for this? -- David Fleck <david.fl...@mchsi.com> _______________________________________________ PLUG mailing list PLUG@lists.pdxlinux.org http://lists.pdxlinux.org/mailman/listinfo/plug