Django not appening "/" on urls in a production server

I have a website written in Django. The website for production or development is deployed in a docker container. It is served over nginx that is also deployed in a docker container. On a development computer when the website is deployed and an address is input without a trailing "/" it is automatically appended and then redirected to the correct page. In a production server, this isn't happening. No redirection commences and the server returns 404.

The only difference between development and production is that the production instance is run with SSL and a domain name.

Here are my NGINX configs for both situations.

Development:

upstream django {
    server django_gunicorn:8000;
}

server {
    listen 80;
   
    location / {
        proxy_pass http://django;
    }

    location /static/ {
        alias /static/;
    }
}

Production:

upstream django {
    server django_gunicorn:8000;
}

server {
    listen 443 ssl;
    
    ssl_certificate /ssl/live/fullchain.pem;
    ssl_certificate_key /ssl/live/privkey.pem;
    
    server_name website.mydomain.com;
    
    location / {
        proxy_pass http://django;
    }

    location /static/ {
        alias /static/;
    }
}

What is the issue, why production server is not redirecting?

Back to Top