1
+ # Nginx Configuration Template for Torrust Tracker Demo
2
+ #
3
+ # Variable Escaping Notes:
4
+ # - This template is processed by envsubst which substitutes all $VARIABLE patterns
5
+ # - Nginx variables (like $proxy_add_x_forwarded_for, $host, $http_upgrade) must be escaped
6
+ # - Use ${ DOLLAR} environment variable to represent literal $ in nginx config
7
+ # - Example: ${ DOLLAR} proxy_add_x_forwarded_for becomes $proxy_add_x_forwarded_for
8
+ #
9
+ # TODO: Fix the commented HTTPS configuration section below
10
+ # - The HTTPS configuration has inconsistent variable escaping
11
+ # - Some nginx variables use literal $ (incorrect) while others should use ${ DOLLAR}
12
+ # - Line 117: proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; (needs ${ DOLLAR} )
13
+ # - Lines with $host, $http_upgrade, $connection_upgrade also need escaping
14
+ # - SSL certificate paths and other static values are correct as-is
15
+
1
16
server
2
17
{
3
18
listen 80;
@@ -11,13 +26,13 @@ server
11
26
location /api/
12
27
{
13
28
proxy_pass http://tracker:1212/api/;
14
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
29
+ proxy_set_header X-Forwarded-For ${DOLLAR } proxy_add_x_forwarded_for;
15
30
}
16
31
17
32
location /
18
33
{
19
34
proxy_pass http://tracker:7070;
20
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
35
+ proxy_set_header X-Forwarded-For ${DOLLAR } proxy_add_x_forwarded_for;
21
36
}
22
37
23
38
location ~ /.well-known/acme-challenge
@@ -109,7 +124,7 @@ server
109
124
# #add_header Strict-Transport-Security " max-age=31536000; includeSubDomains; preload" always;
110
125
# # enable strict transport security only if you understand the implications
111
126
#
112
- # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
127
+ # proxy_set_header X-Forwarded-For ${DOLLAR } proxy_add_x_forwarded_for;
113
128
# }
114
129
#
115
130
# root /var/www/html;
0 commit comments