this post was submitted on 13 Sep 2024
1 points (100.0% liked)

nginx

4 readers
1 users here now

The nginx community on Reddit. Reddit gives you the best of the internet in one place.

founded 1 year ago
MODERATORS
 
The original post: /r/nginx by /u/yukiiiiii2008 on 2024-09-13 05:50:21.

I use the official nginx docker image. Following is my default.conf.template.

server {
 listen 9004; 

root /usr/share/nginx/html;

index index.html;

location ~* .(eot|ttf|woff|woff2|svg)$ { add_header Access-Control-Allow-Origin *; }

location / { try_files $uri $uri/ $uri/index.html /index.html; }


}
```I have a file under`[https://example.com/projects/index.html`](https://example.com/projects/index.html%60). When I access to `https://example.com/projects`, it redirect me to `http://example.com:9004/projects/`.

Note: My `nginx` is behind `traefik`, an another reverse proxy, it passes following headers to `nginx`:
`'x-forwarded-host': 'example.com',
'x-forwarded-port': '443',
'x-forwarded-proto': 'https',
'origin': 'https://example.com',`
How can I utilize this to acheive my goal? I want to log `$uri` to see what's the exact value it has.

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here