Hello, I have an issue where we have Apache 2.4.4.X using mod_proxy_balancer pointing at Apache Tomcat 8. Our applications returning an outside url that has space in the url i.e. (
www.example.com/myapp/ structs/ somedata/ We want to return this url without spaces because it fails. I have tried Apache mod_rewrite and the regex below within my vhost.conf file as well as using it with the Apache tomcat rewrite module inside of a rewrite.conf file with no success.
I confirmed it was working atleast running by using the trace8 on my mod_rewrite loglevel. But, what it doesnt do is clean up the spaces in question.
# remove spaces from start or after /
RewriteRule ^(.*/|)[\s%20]+(.+)$ $1$2 [L]
# remove spaces from end or before /
RewriteRule ^(.+?)[\s%20]+(/.*|)$ $1$2 [L]
# replace spaces by - in between
RewriteRule ^([^\s%20]*)(?:\s|%20)+(.*)$ $1-$2 [L,R]