_location.conf 1.3 KB

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