apache2apache2.4apache2.2apache-modules

Apache Proxy Server Removing Double Slashes


Have configured thumbor on my server as a self hosted CDN. However any URL I pass through it has its double slashes merged and as a result I get an error 400. I am using apache2.4 as a reverse proxy. Here is my virtual host configuration.

<VirtualHost *:443>
    AllowEncodedSlashes NoDecode
    ProxyPreserveHost On
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    <Proxy *>
        Order allow,deny
        Allow from all
        </Proxy>
    ProxyPass / http://localhost:8888/
    ProxyPassReverse / http://localhost:8888/
ServerName images.example.com
SSLCertificateFile /etc/ssl/example.com/fullchain.pem
SSLCertificateKeyFile /etc/ssl/example.com/privkey.pem
</VirtualHost>

Trying to serve images using thumbor so if I put the link

https://images.example.com/unsafe/https://example.com/uploads/media/test.jpg

am getting this in thumbor

https:/example.com/uploads/media/test.jpg(*.*.*.*)

The double slashes have been merged to one which causes an error. How can I escape this behavior?


Solution

  • The trick is the nocanon option that you can find in the documentation.

    If you add this option, the original url is preserved.

    ProxyPass / http://localhost:8888/ nocanon