openresty-config/http.d/locations/inv.conf
2025-03-31 15:54:12 -03:00

106 lines
2.4 KiB
Text

# Notes:
# Required headers that need to be passed to invidious:
# - Host (to be able to identify the domain from where it was accessed, handle numbered domains, alternative domains like .onion and .i2p)
#
# configs/proxy.conf contains the directive to pass the Host header to Invidious
location @upstream {
proxy_pass http://$invidious_backend;
include configs/proxy.conf;
proxy_intercept_errors on;
limit_rate 1000k;
# To reduce the load in the main storage
proxy_buffering off;
proxy_request_buffering off;
#proxy_cache off;
}
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 /index.html {
return 301 $scheme://$host/;
}
location ~ (^/videoplayback) {
# return 403 "
# Videoplayback requests are not allowed in this endpoint.
# Yes, this is an error. If you find it, please report it to
# https://git.nadeko.net/Fijxu/invidious";
#try_files $uri @http3-proxy;
try_files $uri @upstream;
}
location / {
try_files $uri @upstream;
}
location /search {
try_files $uri @upstream;
limit_req zone=invidious-searchrl nodelay burst=3;
}
location /watch_ajax {
try_files $uri @upstream;
}
location /watch {
proxy_pass http://$invidious_backend;
include configs/proxy.conf;
limit_rate 1000k;
# To reduce the load in the main storage
proxy_buffering off;
proxy_request_buffering off;
# proxy_cache off;
# try_files $uri @upstream;
limit_req zone=invidious-watchrl nodelay burst=3;
}
location /feed/playlist {
limit_req zone=invidious-feedplaylist nodelay burst=24;
try_files $uri @upstream;
}
# API #
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;
}
location /api/v1/comments {
try_files $uri @upstream;
}
location /api/v1/auth/notifications {
return 403 "Endpoint disabled";
}
location /api/v1/auth/subscriptions {
return 403 "Endpoint disabled";
}