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+
116server
217{
318 listen 80;
@@ -11,13 +26,13 @@ server
1126 location /api/
1227 {
1328 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;
1530 }
1631
1732 location /
1833 {
1934 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;
2136 }
2237
2338 location ~ /.well-known/acme-challenge
@@ -109,7 +124,7 @@ server
109124# #add_header Strict-Transport-Security " max-age=31536000; includeSubDomains; preload" always;
110125# # enable strict transport security only if you understand the implications
111126#
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;
113128# }
114129#
115130# root /var/www/html;
0 commit comments