#7263·mealie

[BUG] - Proxy headers (e.g. X-Forwarded-For) are incorrectly trusted by default

Author: CaligatioCreated Mar 17, 2026Updated Sep 25, 2026
Labelsbugtriage

First Check

  • This is not a feature request.
  • I added a very descriptive title to this issue (title field is above this).
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the Mealie documentation, with the integrated search.
  • I already read the docs and didn't find an answer.
  • This issue can be replicated on the demo site (https://demo.mealie.io/).

What is the issue you are experiencing?

Mealie is currently configured to trust HTTP proxy headers (e.g. X-Forwarded-For) by default which is bad practice as nefarious clients can spoof these headers easily.

Tracing this through, it appears settings.HOST_IP is used as the forwarded_allow_ips value in main.py. HOST_IP is set to * in settings.py. entry.sh is setting HOST_IP to the default gateway (which is weird) but then fails to export that variable. Since it's not exported, Mealie just uses the default value of *.

I'm not really sure why the default gateway is being used as HOST_IP as that IP should never really be seen by the app. Moreover, I don't understand why that value is being used as the forwarded_allow_ips value. Regardless, the forwarded_allow_ips should be configurable by the user via an environment variable.

Steps to Reproduce

  1. Run the Mealie Docker image in its stock configuration
  2. Either use a reverse proxy in front of Mealie or manually set X-Forwarded-For header
  3. Note that the IP set in X-Forwarded-For is used as the client IP in the logs

Please provide relevant logs

N/A

Mealie Version

Docker Image - ghcr.io/mealie-recipes/mealie:latest d163d4dbe45d Version - v3.12.0 Build - https://github.com/mealie-recipes/mealie/commit/5aafebb7a6e893da95cb3239e806240c3b5347fe

Deployment

Docker (Linux)

Additional Deployment Details

I am using Caddy in front of Mealie