I am trying to configure apache2 proxy settings to
- Exclude proxying the URLs that has trim=1 flag such that the content is served by apache itself.
- Proxy URLs that do not have trim=1 flag to a URL http://1.2.3.4:8080/mywebapp/
I have the following settings in /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPreserveHost On
RewriteEngine on
ProxyPassMatch "(?<=trim=1)$" !
ProxyPassMatch "(?<!trim=1)$" "http://1.2.3.4:8080/mywebapp/"
</VirtualHost>
And I could see that requests with trim=1 flag also gets proxied to http://1.2.3.4:8080/mywebapp/. I tried various settings in regex like lookback and could not get it to work. I would appreciate some help !