mirror of
https://github.com/iv-org/documentation.git
synced 2025-11-23 17:13:17 -05:00
chore: add captions endpoint + rework nginx config
This commit is contained in:
parent
baf62898f3
commit
eafb7fe65f
4 changed files with 30 additions and 42 deletions
|
|
@ -66,6 +66,8 @@ To make the VirtualHost config below actually work, you should as well:
|
|||
ProxyPassReverse /latest_version http://127.0.0.1:8282/
|
||||
ProxyPass /api/manifest/dash/id/ http://127.0.0.1:8282/ nocanon
|
||||
ProxyPassReverse /api/manifest/dash/id/ http://127.0.0.1:8282/
|
||||
ProxyPass /api/v1/captions/ http://127.0.0.1:8282/ nocanon
|
||||
ProxyPassReverse /api/v1/captions/ http://127.0.0.1:8282/
|
||||
ProxyPass /videoplayback http://127.0.0.1:8282/ nocanon
|
||||
ProxyPassReverse /videoplayback http://127.0.0.1:8282/
|
||||
ProxyPreserveHost On
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ https://<server_name> {
|
|||
path /latest_version
|
||||
path /api/manifest/dash/id/*
|
||||
path /videoplayback*
|
||||
/api/v1/captions/*
|
||||
}
|
||||
|
||||
reverse_proxy @companion localhost:8282
|
||||
|
|
|
|||
|
|
@ -4,52 +4,37 @@ This is a very basic config, secured with Let's Encrypt. Any log is disabled by
|
|||
|
||||
```
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
http2 on;
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
|
||||
server_name invidious.domain.tld;
|
||||
server_name invidious.domain.tld;
|
||||
|
||||
access_log off;
|
||||
error_log /var/log/nginx/error.log crit;
|
||||
access_log off;
|
||||
error_log /var/log/nginx/error.log crit;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/invidious.domain.tld/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/invidious.domain.tld/privkey.pem;
|
||||
ssl_certificate /etc/letsencrypt/live/invidious.domain.tld/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/invidious.domain.tld/privkey.pem;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:3000;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header Host $host; # so Invidious knows domain
|
||||
proxy_http_version 1.1; # to keep alive
|
||||
proxy_set_header Connection ""; # to keep alive
|
||||
}
|
||||
# Redirect all HTTP requests to HTTPS
|
||||
if ($scheme = http) {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
location /latest_version {
|
||||
proxy_pass http://127.0.0.1:8282;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header Host $host; # so Invidious companion knows domain
|
||||
proxy_http_version 1.1; # to keep alive
|
||||
proxy_set_header Connection ""; # to keep alive
|
||||
}
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header Host $host;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
|
||||
location /api/manifest/dash/id/ {
|
||||
proxy_pass http://127.0.0.1:8282;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header Host $host; # so Invidious companion knows domain
|
||||
proxy_http_version 1.1; # to keep alive
|
||||
proxy_set_header Connection ""; # to keep alive
|
||||
}
|
||||
# Invidious main service
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:3000;
|
||||
}
|
||||
|
||||
location /videoplayback {
|
||||
proxy_pass http://127.0.0.1:8282;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header Host $host; # so Invidious companion knows domain
|
||||
proxy_http_version 1.1; # to keep alive
|
||||
proxy_set_header Connection ""; # to keep alive
|
||||
}
|
||||
|
||||
if ($https = '') { return 301 https://$host$request_uri; } # if not connected to HTTPS, perma-redirect to HTTPS
|
||||
# Invidious companion service (multiple paths, same backend)
|
||||
location ~ ^/(latest_version|videoplayback|api/(v1/captions|manifest/dash/id))/ {
|
||||
proxy_pass http://127.0.0.1:8282;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ Do not forget to replace `<server_name>` with your domain.
|
|||
...
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.invidious.rule=Host(`<server_name>`) && !(Path(`/latest_version`) || PathPrefix(`/api/manifest/dash/id/`) || PathPrefix(`/videoplayback`))"
|
||||
- "traefik.http.routers.invidious.rule=Host(`<server_name>`) && !(Path(`/latest_version`) || PathPrefix(`/api/manifest/dash/id/`) || PathPrefix(`/api/v1/captions/`) || PathPrefix(`/videoplayback`))"
|
||||
- "traefik.http.routers.invidious.entrypoints=web-sec"
|
||||
- "traefik.http.routers.invidious.tls.certresolver=le"
|
||||
- "traefik.http.services.invidious.loadbalancer.server.port=3000"
|
||||
|
|
@ -19,7 +19,7 @@ Do not forget to replace `<server_name>` with your domain.
|
|||
...
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.invidious-companion.rule=Host(`<server_name>`) && (Path(`/latest_version`) || PathPrefix(`/api/manifest/dash/id/`) || PathPrefix(`/videoplayback`))"
|
||||
- "traefik.http.routers.invidious-companion.rule=Host(`<server_name>`) && (Path(`/latest_version`) || PathPrefix(`/api/manifest/dash/id/`) || PathPrefix(`/api/v1/captions/`) || PathPrefix(`/videoplayback`))"
|
||||
- "traefik.http.routers.invidious-companion.entrypoints=web-sec"
|
||||
- "traefik.http.routers.invidious-companion.tls.certresolver=le"
|
||||
- "traefik.http.services.invidious-companion.loadbalancer.server.port=8282"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue