mirror of
https://github.com/getumbrel/umbrel-apps.git
synced 2026-11-20 21:23:41 +03:00
Co-authored-by: Kai Chappel <kaichappel@users.noreply.github.com> Co-authored-by: nmfretz <nmfretz@gmail.com>
68 lines
2.4 KiB
Plaintext
68 lines
2.4 KiB
Plaintext
worker_processes auto;
|
|
pid /tmp/nginx.pid;
|
|
error_log /dev/stderr warn;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
# Audio URLs contain bearer tokens, so do not log request URLs.
|
|
access_log off;
|
|
client_body_temp_path /tmp/client_temp;
|
|
proxy_temp_path /tmp/proxy_temp;
|
|
fastcgi_temp_path /tmp/fastcgi_temp;
|
|
uwsgi_temp_path /tmp/uwsgi_temp;
|
|
scgi_temp_path /tmp/scgi_temp;
|
|
|
|
map ${APP_OPENREADER_NGINX_DOLLAR}http_x_forwarded_proto ${APP_OPENREADER_NGINX_DOLLAR}forwarded_proto {
|
|
default ${APP_OPENREADER_NGINX_DOLLAR}http_x_forwarded_proto;
|
|
'' ${APP_OPENREADER_NGINX_DOLLAR}scheme;
|
|
}
|
|
|
|
server {
|
|
listen 8080;
|
|
client_max_body_size 0;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host ${APP_OPENREADER_NGINX_DOLLAR}http_host;
|
|
proxy_set_header X-Forwarded-Proto ${APP_OPENREADER_NGINX_DOLLAR}forwarded_proto;
|
|
proxy_set_header X-Forwarded-For ${APP_OPENREADER_NGINX_DOLLAR}proxy_add_x_forwarded_for;
|
|
proxy_set_header Connection '';
|
|
proxy_buffering off;
|
|
proxy_request_buffering off;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
|
|
# v5 emits an absolute worker URL. Only rewrite the session JSON response;
|
|
# document bodies, downloads and JavaScript are never filtered.
|
|
# Preserve the signed token; the worker still validates it on audio requests.
|
|
# Recheck this endpoint and URL format on upstream upgrades. Remove this
|
|
# rewrite when OpenReader can emit relative playback URLs natively.
|
|
location = /api/tts/stream/sessions {
|
|
proxy_pass http://openreader_web_1:3003;
|
|
proxy_set_header Host ${APP_OPENREADER_NGINX_DOLLAR}http_host;
|
|
proxy_set_header X-Forwarded-Proto ${APP_OPENREADER_NGINX_DOLLAR}forwarded_proto;
|
|
proxy_set_header X-Forwarded-For ${APP_OPENREADER_NGINX_DOLLAR}proxy_add_x_forwarded_for;
|
|
proxy_set_header Connection '';
|
|
proxy_set_header Accept-Encoding '';
|
|
sub_filter_types application/json;
|
|
sub_filter 'http://openreader-playback.invalid/v1/tts-playback/' '/v1/tts-playback/';
|
|
}
|
|
|
|
# Expose only signed playback, never worker control or health endpoints.
|
|
# Nginx forwards Range requests and streams partial responses unchanged.
|
|
location ~ ^/v1/tts-playback/sessions/[^/]+/audio$ {
|
|
limit_except GET { deny all; }
|
|
proxy_pass http://openreader_web_1:8081;
|
|
}
|
|
|
|
location /v1/ {
|
|
return 404;
|
|
}
|
|
|
|
location / {
|
|
proxy_pass http://openreader_web_1:3003;
|
|
}
|
|
}
|
|
}
|