Files
hassio-addons/komga/rootfs/etc/nginx/servers/ingress.conf
alexbelgium 08029b9e37 fix(komga): restore add-on reverted by a transient ghcr login failure
The amd64 builder job failed at docker login (denied: denied) before any build
step ran, which tripped revert-on-failure. Re-running the same commit unchanged
succeeded and both arch images are published.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-11 18:30:36 +02:00

61 lines
2.8 KiB
Plaintext

server {
listen %%interface%%:%%port%% default_server;
client_max_body_size 0;
# Home Assistant opens the ingress panel at <ingress_entry>/ and forwards it
# as / , but Komga only answers below its servlet context path (/komga), so
# bounce the panel there. absolute_redirect off keeps the Location relative
# to the HA host instead of nginx's own listen address.
location = / {
absolute_redirect off;
return 302 %%ingress_entry%%/komga/;
}
location / {
add_header Access-Control-Allow-Origin *;
proxy_connect_timeout 30m;
proxy_send_timeout 30m;
proxy_read_timeout 30m;
proxy_pass http://127.0.0.1:25600;
# Komga pushes live events over SSE (/komga/sse/v1/events), which must
# not be buffered or the UI stops refreshing until the buffer fills
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
# Spring redirects /komga to /komga/ ; the Location it produces is
# absolute against the upstream address, so rewrite it back onto the
# ingress path (the second rule covers an already relative Location).
absolute_redirect off;
proxy_redirect http://127.0.0.1:25600/ %%ingress_entry%%/;
proxy_redirect / %%ingress_entry%%/;
# Komga renders its index page with Thymeleaf @{...} link expressions,
# so every asset url and window.resourceBaseUrl carry the context path
# (/komga). Ingress strips its own prefix before forwarding, so the
# browser needs that prefix added back. Only text/html is rewritten
# (the nginx default for sub_filter_types) : the SPA derives its api
# origin and router base from resourceBaseUrl at runtime, so json
# responses and book pages stream through untouched.
proxy_set_header Accept-Encoding "";
sub_filter_once off;
sub_filter "/komga" "%%ingress_entry%%/komga";
# The epub/divina reader fetches a Readium manifest whose links Komga
# builds with ServletUriComponentsBuilder.fromCurrentContextPath(), so
# they are fully absolute against the upstream address nginx talks to
# (http://127.0.0.1:25600/komga). Rewriting them to a root relative
# ingress path also fixes the scheme : Home Assistant may be served over
# https, and an absolute http:// link would be blocked as mixed content.
# Only the json/xml document types are added here, so book pages are
# never scanned.
sub_filter "http://127.0.0.1:25600/komga" "%%ingress_entry%%/komga";
sub_filter_types application/json application/webpub+json
application/divina+json application/opds+json
application/atom+xml;
}
}