_location.conf 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. location {{ path }} {
  2. proxy_set_header Host $host;
  3. proxy_set_header X-Forwarded-Scheme $scheme;
  4. proxy_set_header X-Forwarded-Proto $scheme;
  5. proxy_set_header X-Forwarded-For $remote_addr;
  6. proxy_set_header X-Real-IP $remote_addr;
  7. proxy_pass {{ forward_scheme }}://{{ forward_host }}:{{ forward_port }}{{ forward_path }};
  8. {% if access_list_id > 0 %}
  9. {% if access_list.items.length > 0 %}
  10. # Authorization
  11. auth_basic "Authorization required";
  12. auth_basic_user_file /data/access/{{ access_list_id }};
  13. {{ access_list.passauth }}
  14. {% endif %}
  15. # Access Rules
  16. {% for client in access_list.clients %}
  17. {{- client.rule -}};
  18. {% endfor %}deny all;
  19. # Access checks must...
  20. {% if access_list.satisfy %}
  21. {{ access_list.satisfy }};
  22. {% endif %}
  23. {% endif %}
  24. {% include "_assets.conf" %}
  25. {% include "_exploits.conf" %}
  26. {% include "_forced_ssl.conf" %}
  27. {% include "_hsts.conf" %}
  28. {% if allow_websocket_upgrade == 1 or allow_websocket_upgrade == true %}
  29. proxy_set_header Upgrade $http_upgrade;
  30. proxy_set_header Connection $http_connection;
  31. proxy_http_version 1.1;
  32. {% endif %}
  33. {{ advanced_config }}
  34. }