Nginx reverse proxy to apache adds a trailing slash at the end

I have an nginx reverse proxy set up like this:


server {
        listen 80;
        listen [::]:80;

        root /var/www/html;
        index index.html index.htm index.nginx-debian.html;


        location / {
        proxy_pass http://localhost:8090;
        autoindex on;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;


The site is on Apache, which is listening on port 8090.

So, /etc/apache2/ports.conf looks like this:

Listen 8090

<IfModule ssl_module>
        Listen 443

<IfModule mod_gnutls.c>
        Listen 443

It works, but a trailing slash is added. So I can see my website at

I’m not sure if it’s nginx or apache causing the trailing extra slash at the end. How can I fix this?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.


this would be from the Nginx Configuration for sure, this is a know issues with it. Most probably you’ve added a trailing slash somewhere along the way.

Please check your Nginx configuration file for the domain and make sure there is no trailing slash when doing rewrites such as :

Rewrite ^(.*)$ https://$$1;



Another problematic area might be:

 location / {
        proxy_pass http://localhost:8090/;

I know you’ve provided us with an example configuration file but please take another look to the exact domain’s file and make sure there are no leftover trailing slashes.