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.
You must log in or register to comment.