reverseproxy_ynh/conf/nginx.conf

41 lines
1.2 KiB
Nginx Configuration File
Raw Normal View History

2024-08-24 22:58:21 +02:00
location @{{ name }}--proxy {
proxy_pass {{ proxy_path }};
2016-06-20 23:43:51 +02:00
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Port $server_port;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
2016-06-20 23:43:51 +02:00
more_clear_input_headers 'Accept-Encoding';
}
2023-01-08 14:33:31 +01:00
2024-08-24 22:58:21 +02:00
location = {{ path }} {
return 302 {{ path }};
}
2023-01-08 14:33:31 +01:00
2024-08-24 22:58:21 +02:00
location {{ path }}/ {
{% if assets_path %}
alias {{ assets_path }};
{% endif %}
2024-08-24 22:58:21 +02:00
# This is a reverse-proxy, not a basic HTML site
# We do not wish to enable autoindex in general, and will
# not try_files uri/ for this reason.
#
# But if no assets_path is defined, try the backend directly.
#
# Note: We could include an app setting for autoindex some time.
# But try_files uri/ without autoindex will result in 403.
{% if assets_path %}
try_files $uri @{{ name }}--proxy =@404;
{% else %}
try_files ${{ name }}--proxy =@404;
{% endif %}
2023-01-08 14:33:31 +01:00
}