Skip to content

Document: reverse proxies must forward the original Host header #1276

Backlog

Description

@naltatis

refs evcc-io/evcc#36723, GHSA-whjp-9vmj-qjrc

Since 0.320.0 evcc rejects browser requests from foreign origins. A reverse proxy has to forward the original Host header including the port. So far this is only written down in the agent docs and in the advisory. It needs a place on docs.evcc.io.

Content

  • Requirement: the proxy forwards the Host header the browser sent, including the port.

  • Symptom: the UI loads but shows as offline. The log contains request Origin "…" is not authorized for Host "…". Over plain HTTP, changes fail as well with cross-origin request detected.

  • Settings per proxy:

    Proxy Setting
    nginx proxy_set_header Host $host; on port 80 or 443
    nginx proxy_set_header Host $host:$server_port; otherwise
    Apache ProxyPreserveHost On
    Caddy none, Host is kept by default
    Traefik none, Host is kept by default
  • nginx port detail: $host drops the port, so a non-default port has to be added with $host:$server_port. $server_port is the port nginx listens on. If the browser uses a different one, for example behind a router port mapping, set it explicitly ($host:8443).

  • $http_host also works, but nginx advises against it, see this comment.

  • Home Assistant: ingress passes Host on unchanged. A reverse proxy in front of Home Assistant has to forward it as well.

Where

  • Main section: reference/web-ui or reference/configuration/uri (network, already mentions reverse proxies at externalUrl).
  • installation/home-assistant: short note with a link to the main section.
  • installation/freebsd: change the nginx example from $http_host to $host and link to the main section.

Open

  • decide on the page for the main section

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions