add server override includes and redirect legacy endpoints (#541)

* add server override includes

* adjusting directory name
This commit is contained in:
Karol Wypchło 2020-11-26 11:44:55 +01:00 committed by GitHub
parent 3eaef976cf
commit a0aba97298
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 19 deletions

4
.gitignore vendored
View File

@ -78,6 +78,10 @@ docker/data
# Docker override # Docker override
docker-compose.override.yml docker-compose.override.yml
# Nginx custom server overrides
docker/nginx/conf.d/server-override/*
!docker/nginx/conf.d/server-override/example
# Cache files # Cache files
__pycache__ __pycache__
/.idea/ /.idea/

View File

@ -50,6 +50,8 @@ server {
client_max_body_size 128k; client_max_body_size 128k;
# legacy endpoint rewrite # legacy endpoint rewrite
rewrite /portals /skynet/portals permanent;
rewrite /stats /skynet/stats permanent;
rewrite /skynet/blacklist /skynet/blocklist permanent; rewrite /skynet/blacklist /skynet/blocklist permanent;
location / { location / {
@ -87,15 +89,6 @@ server {
proxy_pass http://siad/skynet/blocklist; proxy_pass http://siad/skynet/blocklist;
} }
location /portals {
include /etc/nginx/conf.d/include/cors;
proxy_cache skynet;
proxy_cache_valid any 1m; # cache portals for 1 minute
proxy_set_header User-Agent: Sia-Agent;
proxy_pass http://siad/skynet/portals;
}
location /skynet/portals { location /skynet/portals {
include /etc/nginx/conf.d/include/cors; include /etc/nginx/conf.d/include/cors;
@ -105,16 +98,6 @@ server {
proxy_pass http://siad/skynet/portals; proxy_pass http://siad/skynet/portals;
} }
location /stats {
include /etc/nginx/conf.d/include/cors;
proxy_cache skynet;
proxy_cache_valid any 10m; # cache stats for 10 minutes
proxy_set_header User-Agent: Sia-Agent;
proxy_read_timeout 5m; # extend the read timeout
proxy_pass http://siad/skynet/stats;
}
location /skynet/stats { location /skynet/stats {
include /etc/nginx/conf.d/include/cors; include /etc/nginx/conf.d/include/cors;
@ -308,4 +291,7 @@ server {
proxy_pass http://127.0.0.1/$uri?attachment=true&$args; proxy_pass http://127.0.0.1/$uri?attachment=true&$args;
} }
# include custom locations, specific to the server
include /etc/nginx/conf.d/server-override/*;
} }

View File

@ -0,0 +1,7 @@
# Every file from within this directory will be included in the server block
# of the nginx configuration, at the very end. See client.conf.
#
# Example:
# location /blog {
# root /var/www/blog;
# }