[GH-ISSUE #4456] [Issue]: Accessing reverse-proxied container behind domain name fails #2418

Closed
opened 2026-10-21 05:48:03 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @kara-eressea on GitHub (Aug 2, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4456

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Attempting to host the Docker container behind a reverse proxy (Caddy) fails due to TRUSTED_HOSTS, even after adding the domain name. Please let me know if you need any additional info.

Expected behavior

I would have expected that after adding my domain name to TRUSTED_HOSTS that it would work.

Actual behavior

When attempting to access the domain I have it reverse proxied to, I get the following error. I've redacted the actual URL.

{"error":"Untrusted request host","message":"Host 'subdomain.domain.tld' is not an allowed Marinara address. Use an IP address, a local hostname, or add the exact hostname to TRUSTED_HOSTS."}

Steps to reproduce

  1. Copy docker-compose.yml and set up the .env file, making sure to add domain name to the .env file
  2. Create or update Caddyfile with the reverse proxy directive:
subdomain.domain.tld {
        reverse_proxy http://127.0.0.1:7860
}
  1. Start the Docker container and attempt to access the URL, and the error as above appears.

Environment

  • Marinara Engine version: latest
  • Install type: Docker
  • OS + version: Ubuntu Server 26.04
  • Browser or app shell: Browser

Logs, screenshots, or video

{"error":"Untrusted request host","message":"Host 'subdomain.domain.tld' is not an allowed Marinara address. Use an IP address, a local hostname, or add the exact hostname to TRUSTED_HOSTS."}

Additional context

Added the specific domain to TRUSTED_HOSTS=, CORS_ORIGINS=, and CSRF_TRUSTED_ORIGINS

.env

# Marinara Engine Environment Configuration
# Copy this file to .env, then change the values after "=".
# The launcher ignores lines that start with "#", so editable settings below are
# written as real KEY=value entries with safe defaults.

# Server
PORT=7860
# Bare `pnpm start` defaults to 127.0.0.1; the shell launchers default to 0.0.0.0 unless you override HOST here.
HOST=0.0.0.0
# Public/reverse-proxy hostnames accepted by the HTTP Host check. IP addresses,
# localhost, .local/.home.arpa names, and single-label LAN/container names work
# automatically. Comma-separated; ports are ignored.
TRUSTED_HOSTS=subdomain.domain.tld
# Shell launchers open the local URL by default. Set false to disable.
AUTO_OPEN_BROWSER=false
...
# Professor Mari Fandom/MediaWiki read CLI (`mari wiki`).
MARI_WIKI_CONTENT_MAX_BYTES=50000
MARI_WIKI_REQUEST_TIMEOUT_MS=30000
MARI_WIKI_CACHE_TTL_MS=300000

# CORS (comma-separated origins, or * for allow-all without credentials)
CORS_ORIGINS=http://localhost:5173,http://127.0.0.1:5173,https://subdomain.domain.tld

# SSL/TLS — set both to enable HTTPS (leave empty for plain HTTP)
SSL_CERT=
SSL_KEY=
...
# CSRF / Origin protection for browser-origin unsafe API requests.
# The client sends X-Marinara-CSRF automatically.
#
# Auto-trusted without listing here:
#   - http://127.0.0.1:<PORT> and http://localhost:<PORT>
#   - The HOST-bound origin (when HOST is a specific IP/name, not 0.0.0.0/::)
#   - Any RFC 1918 / CGNAT (Tailscale 100.64.0.0/10) / Docker bridge
#     (172.16.0.0/12) / link-local IP literal where the browser's Origin
#     matches the server's Host header — covers most Tailscale, Docker, and
#     LAN access without manual configuration.
#
# Add an entry here ONLY for origins the auto-trust does not cover:
#   - A public IP/hostname (e.g. http://203.0.113.10:7831)
#   - A reverse-proxy domain (e.g. https://chat.example.com)
#   - A Tailscale MagicDNS hostname (e.g. http://my-box.tailnet.ts.net:7860)
# Comma-separated. No restart needed (takes effect within ~2s).
#   Example: CSRF_TRUSTED_ORIGINS=http://203.0.113.10:7831,https://chat.example.com
# Set to * only if you intentionally trust every browser origin that can
# reach this server.
CSRF_TRUSTED_ORIGINS=https://subdomain.domain.tld
...

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • [] I DID NOT read this template and provide the requested details.
Originally created by @kara-eressea on GitHub (Aug 2, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4456 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Attempting to host the Docker container behind a reverse proxy (Caddy) fails due to TRUSTED_HOSTS, even after adding the domain name. Please let me know if you need any additional info. ## Expected behavior I would have expected that after adding my domain name to TRUSTED_HOSTS that it would work. ## Actual behavior When attempting to access the domain I have it reverse proxied to, I get the following error. I've redacted the actual URL. {"error":"Untrusted request host","message":"Host 'subdomain.domain.tld' is not an allowed Marinara address. Use an IP address, a local hostname, or add the exact hostname to TRUSTED_HOSTS."} ## Steps to reproduce 1. Copy docker-compose.yml and set up the .env file, making sure to add domain name to the .env file 2. Create or update Caddyfile with the reverse proxy directive: ``` subdomain.domain.tld { reverse_proxy http://127.0.0.1:7860 } ``` 3. Start the Docker container and attempt to access the URL, and the error as above appears. ## Environment - Marinara Engine version: latest - Install type: Docker - OS + version: Ubuntu Server 26.04 - Browser or app shell: Browser ## Logs, screenshots, or video {"error":"Untrusted request host","message":"Host 'subdomain.domain.tld' is not an allowed Marinara address. Use an IP address, a local hostname, or add the exact hostname to TRUSTED_HOSTS."} ## Additional context Added the specific domain to `TRUSTED_HOSTS=`, `CORS_ORIGINS=`, and `CSRF_TRUSTED_ORIGINS` **.env** ``` # Marinara Engine Environment Configuration # Copy this file to .env, then change the values after "=". # The launcher ignores lines that start with "#", so editable settings below are # written as real KEY=value entries with safe defaults. # Server PORT=7860 # Bare `pnpm start` defaults to 127.0.0.1; the shell launchers default to 0.0.0.0 unless you override HOST here. HOST=0.0.0.0 # Public/reverse-proxy hostnames accepted by the HTTP Host check. IP addresses, # localhost, .local/.home.arpa names, and single-label LAN/container names work # automatically. Comma-separated; ports are ignored. TRUSTED_HOSTS=subdomain.domain.tld # Shell launchers open the local URL by default. Set false to disable. AUTO_OPEN_BROWSER=false ... # Professor Mari Fandom/MediaWiki read CLI (`mari wiki`). MARI_WIKI_CONTENT_MAX_BYTES=50000 MARI_WIKI_REQUEST_TIMEOUT_MS=30000 MARI_WIKI_CACHE_TTL_MS=300000 # CORS (comma-separated origins, or * for allow-all without credentials) CORS_ORIGINS=http://localhost:5173,http://127.0.0.1:5173,https://subdomain.domain.tld # SSL/TLS — set both to enable HTTPS (leave empty for plain HTTP) SSL_CERT= SSL_KEY= ... # CSRF / Origin protection for browser-origin unsafe API requests. # The client sends X-Marinara-CSRF automatically. # # Auto-trusted without listing here: # - http://127.0.0.1:<PORT> and http://localhost:<PORT> # - The HOST-bound origin (when HOST is a specific IP/name, not 0.0.0.0/::) # - Any RFC 1918 / CGNAT (Tailscale 100.64.0.0/10) / Docker bridge # (172.16.0.0/12) / link-local IP literal where the browser's Origin # matches the server's Host header — covers most Tailscale, Docker, and # LAN access without manual configuration. # # Add an entry here ONLY for origins the auto-trust does not cover: # - A public IP/hostname (e.g. http://203.0.113.10:7831) # - A reverse-proxy domain (e.g. https://chat.example.com) # - A Tailscale MagicDNS hostname (e.g. http://my-box.tailnet.ts.net:7860) # Comma-separated. No restart needed (takes effect within ~2s). # Example: CSRF_TRUSTED_ORIGINS=http://203.0.113.10:7831,https://chat.example.com # Set to * only if you intentionally trust every browser origin that can # reach this server. CSRF_TRUSTED_ORIGINS=https://subdomain.domain.tld ... ``` ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:48:03 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#2418
No description provided.