Skip to content
This repository was archived by the owner on Dec 31, 2025. It is now read-only.
This repository was archived by the owner on Dec 31, 2025. It is now read-only.

Trailing Slash issue with ngnix configuration #53

Description

@N3evin

I will be posting my Nginx configuration to see if anyone can help solve this issue. Seems like it will add a trailing slash when and cause a redirect loop.

server {
    listen 80;
    listen [::]:80;
    server_name amiiboapi.com www.amiiboapi.com;

    location / {
        add_header 'Access-Control-Allow-Origin' '*' always;
    	return 301 https://$server_name$request_uri;
    }
}

server {
    listen 443 ssl;
    server_name amiiboapi.com www.amiiboapi.com;

    location /api(.*)$ {
    	limit_req zone=mylimit;
    	proxy_pass http://client:8080/api$1$is_args$args;
        proxy_redirect     off;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Host $server_name;
    }

    location / {
        proxy_pass http://client:8080;
        proxy_redirect     off;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Host $server_name;
    }

    ssl_certificate /etc/letsencrypt/live/certification.pem;
    ssl_certificate_key /etc/letsencrypt/live/key.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions