261 lines
6.4 KiB
Text
261 lines
6.4 KiB
Text
location @upstream {
|
|
proxy_pass http://$invidious_backend;
|
|
limit_rate 1000k;
|
|
# To reduce the load in the main storage
|
|
proxy_buffering off;
|
|
proxy_request_buffering off;
|
|
#proxy_cache off;
|
|
|
|
# To let invidious know the Host header, needed for alternative_domains.
|
|
# https://git.nadeko.net/Fijxu/invidious/commit/35f28b508ea049118cb6a0b3062b6c7ce2c4009f
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_pass_request_headers on;
|
|
proxy_intercept_errors on;
|
|
proxy_connect_timeout 10s;
|
|
|
|
# To keep-alive
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection "";
|
|
|
|
error_page 502 /502.html;
|
|
error_page 503 /503.html;
|
|
|
|
if ($request_method = OPTIONS) {
|
|
return 204;
|
|
}
|
|
|
|
proxy_hide_header Access-Control-Allow-Origin;
|
|
add_header Access-Control-Allow-Credentials true;
|
|
add_header Access-Control-Allow-Origin "https://materialious.nadeko.net" always;
|
|
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS, HEAD, PATCH, PUT, DELETE" always;
|
|
add_header Access-Control-Allow-Headers "User-Agent, Authorization, Content-Type" always;
|
|
}
|
|
|
|
location @upstream-api {
|
|
proxy_pass http://inv;
|
|
limit_rate 1000k;
|
|
# To reduce the load in the main storage
|
|
proxy_buffering on;
|
|
proxy_request_buffering off;
|
|
#proxy_cache off;
|
|
|
|
proxy_cache invidious-api-cache;
|
|
proxy_cache_valid 200 240m;
|
|
add_header X-Cache $upstream_cache_status;
|
|
proxy_cache_key "$host$request_uri$cache_case";
|
|
|
|
# To let invidious know the Host header, needed for alternative_domains.
|
|
# https://git.nadeko.net/Fijxu/invidious/commit/35f28b508ea049118cb6a0b3062b6c7ce2c4009f
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_pass_request_headers on;
|
|
proxy_intercept_errors on;
|
|
proxy_connect_timeout 10s;
|
|
|
|
# To keep-alive
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection "";
|
|
|
|
error_page 502 /502.html;
|
|
error_page 503 /503.html;
|
|
|
|
if ($request_method = OPTIONS) {
|
|
return 204;
|
|
}
|
|
|
|
proxy_hide_header Access-Control-Allow-Origin;
|
|
add_header Access-Control-Allow-Credentials true;
|
|
add_header Access-Control-Allow-Origin "https://materialious.nadeko.net" always;
|
|
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS, HEAD, PATCH, PUT, DELETE" always;
|
|
add_header Access-Control-Allow-Headers "User-Agent, Authorization, Content-Type" always;
|
|
}
|
|
|
|
location @upstream-latest_version {
|
|
proxy_pass http://inv;
|
|
limit_rate 1000k;
|
|
# To reduce the load in the main storage
|
|
proxy_buffering on;
|
|
proxy_request_buffering off;
|
|
#proxy_cache off;
|
|
|
|
proxy_cache invidious-latest_version-cache;
|
|
proxy_cache_valid 302 240m;
|
|
add_header X-Cache $upstream_cache_status;
|
|
proxy_cache_key "$host$request_uri$cache_case";
|
|
|
|
# To let invidious know the Host header, needed for alternative_domains.
|
|
# https://git.nadeko.net/Fijxu/invidious/commit/35f28b508ea049118cb6a0b3062b6c7ce2c4009f
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_pass_request_headers on;
|
|
proxy_intercept_errors on;
|
|
proxy_connect_timeout 10s;
|
|
|
|
# To keep-alive
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection "";
|
|
|
|
error_page 502 /502.html;
|
|
error_page 503 /503.html;
|
|
|
|
proxy_hide_header Access-Control-Allow-Origin;
|
|
add_header Access-Control-Allow-Credentials true;
|
|
add_header Access-Control-Allow-Origin "https://materialious.nadeko.net" always;
|
|
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS, HEAD, PATCH, PUT, DELETE" always;
|
|
add_header Access-Control-Allow-Headers "User-Agent, Authorization, Content-Type" always;
|
|
}
|
|
|
|
location @http3-proxy {
|
|
proxy_pass http://http3-ytproxy;
|
|
limit_rate 600k;
|
|
# proxy_intercept_errors on;
|
|
# To reduce the load in the main storage
|
|
proxy_buffering off;
|
|
proxy_request_buffering off;
|
|
proxy_cache off;
|
|
|
|
sendfile_max_chunk 512k;
|
|
proxy_set_header X-Forwarded-For "";
|
|
proxy_set_header Connection "keep-alive";
|
|
proxy_hide_header "alt-svc";
|
|
proxy_hide_header Cache-Control;
|
|
proxy_hide_header ETag;
|
|
proxy_pass_request_headers on;
|
|
proxy_http_version 1.1;
|
|
}
|
|
|
|
location @xd {
|
|
proxy_pass http://http3-ytproxy;
|
|
limit_rate 600k;
|
|
# Proxy buffering needs to be on in order
|
|
# to make the cache work
|
|
proxy_buffering on;
|
|
proxy_request_buffering off;
|
|
|
|
proxy_cache invidious-image-cache;
|
|
proxy_cache_valid 200 48h;
|
|
add_header X-Cache $upstream_cache_status;
|
|
|
|
proxy_http_version 1.1;
|
|
}
|
|
|
|
location ~ (^/videoplayback) {
|
|
return 403 "";
|
|
try_files $uri @http3-proxy;
|
|
}
|
|
|
|
location ~ (^/vi/) {
|
|
try_files $uri @xd;
|
|
}
|
|
|
|
location ~ (^/ggpht/) {
|
|
try_files $uri @xd;
|
|
}
|
|
|
|
location /latest_version {
|
|
try_files $uri @upstream-latest_version;
|
|
limit_req zone=invidious-latestversionrl nodelay burst=12;
|
|
}
|
|
|
|
location /index.html {
|
|
return 301 $scheme://$host/;
|
|
}
|
|
|
|
location / {
|
|
try_files $uri @upstream;
|
|
}
|
|
|
|
location /search {
|
|
try_files $uri @upstream;
|
|
limit_req zone=invidious-searchrl nodelay burst=3;
|
|
}
|
|
|
|
location /watch {
|
|
try_files $uri @upstream;
|
|
limit_req zone=invidious-watchrl nodelay burst=3;
|
|
}
|
|
|
|
location /api/v1 {
|
|
limit_req zone=invidious-apirl nodelay burst=100;
|
|
try_files $uri @upstream;
|
|
}
|
|
|
|
location ~ ^/api/v1/(videos|channels|search|mixes|trending) {
|
|
if ($http_user_agent !~ "Clipious/") {
|
|
return 401 "API disabled";
|
|
}
|
|
try_files $uri @upstream-api;
|
|
}
|
|
|
|
location /api/v1/comments {
|
|
try_files $uri @upstream-api;
|
|
}
|
|
|
|
location /api/v1/auth/notifications {
|
|
return 403 "Endpoint disabled";
|
|
}
|
|
|
|
location /api/v1/auth/subscriptions {
|
|
return 403 "Endpoint disabled";
|
|
}
|
|
|
|
location /feed/playlist {
|
|
limit_req zone=invidious-feedplaylist nodelay burst=24;
|
|
try_files $uri @upstream;
|
|
}
|
|
|
|
# location /api/v1/storyboards {
|
|
# try_files $uri @upstream;
|
|
# }
|
|
#
|
|
# location /api/v1/comments {
|
|
# try_files $uri @upstream;
|
|
# }
|
|
|
|
# location ~ (^/api/v1/videos| {
|
|
# return 401 "API disabled";
|
|
# }
|
|
# location /api/v1/channels {
|
|
# return 401 "API disabled";
|
|
# }
|
|
# location /api/v1/search {
|
|
# return 401 "API disabled";
|
|
# }
|
|
# location /api/v1/mixes {
|
|
# return 401 "API disabled";
|
|
# }
|
|
# location /api/v1/trending {
|
|
# return 401 "API disabled";
|
|
# }
|
|
#
|
|
# location /api/v1/videos {
|
|
# limit_req zone=invidious-apivideosrl nodelay burst=3;
|
|
# try_files $uri @upstream-api;
|
|
# if ($http_user_agent = "Mozilla/5.0") {
|
|
# return 444;
|
|
# }
|
|
# if ($http_user_agent ~* "python") {
|
|
# return 444;
|
|
# }
|
|
# }
|
|
|
|
# location /api/v1/channels {
|
|
# limit_req zone=invidious-apichannelsrl nodelay burst=32;
|
|
# try_files $uri @upstream;
|
|
# }
|
|
|
|
#
|
|
# location /api/v1/captions {
|
|
# try_files $uri @upstream;
|
|
# }
|
|
#
|
|
|
|
#location ~ ^/api/v1/channels/(.+)/shorts {
|
|
# try_files $uri @upstream;
|
|
#}
|
|
|
|
#location @fallback {
|
|
# root /etc/nginx/errors;
|
|
# try_files $uri /502.html = 502;
|
|
#}
|