R
Railway12mo ago
Tim

Logs filled with errors due to django allowed hosts settings

My issue is similar to https://discord.com/channels/713503345364697088/1172062119710171176/1172063615537385504 My logs are filled with stuff like this:
django.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: '35.204.95.109:8052'. You may need to add '35.204.95.109' to ALLOWED_HOSTS.
...
django.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: '0.0.0.0:8052'. You may need to add '0.0.0.0' to ALLOWED_HOSTS.
...
django.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: '0.0.0.0:8052'. You may need to add '0.0.0.0' to ALLOWED_HOSTS.
...
ERROR Invalid HTTP_HOST header: 'www'. You may need to add 'www' to ALLOWED_HOSTS.
django.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: 'www'. You may need to add 'www' to ALLOWED_HOSTS.
ERROR Invalid HTTP_HOST header: '35.204.95.109:8052'. You may need to add '35.204.95.109' to ALLOWED_HOSTS.
django.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: '35.204.95.109:8052'. You may need to add '35.204.95.109' to ALLOWED_HOSTS.
django.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: '35.204.95.109:8052'. You may need to add '35.204.95.109' to ALLOWED_HOSTS.
...
django.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: '0.0.0.0:8052'. You may need to add '0.0.0.0' to ALLOWED_HOSTS.
...
django.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: '0.0.0.0:8052'. You may need to add '0.0.0.0' to ALLOWED_HOSTS.
...
ERROR Invalid HTTP_HOST header: 'www'. You may need to add 'www' to ALLOWED_HOSTS.
django.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: 'www'. You may need to add 'www' to ALLOWED_HOSTS.
ERROR Invalid HTTP_HOST header: '35.204.95.109:8052'. You may need to add '35.204.95.109' to ALLOWED_HOSTS.
django.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: '35.204.95.109:8052'. You may need to add '35.204.95.109' to ALLOWED_HOSTS.
The site works fine, but it makes monitoring actual errors rather annoying. How to fix this?
10 Replies
Percy
Percy12mo ago
Project ID: a9861a99-1c51-4b34-8970-6e92d5cd7f47
Tim
TimOP12mo ago
a9861a99-1c51-4b34-8970-6e92d5cd7f47
Brody
Brody12mo ago
add it to your allowed hosts?
Tim
TimOP12mo ago
Sounds like a bad idea (security-wise) to add ip addresses that are unknown to me to the allowed-hosts setting. Why is railway trying to host my app on other domains than the one that is specified?
Brody
Brody12mo ago
because your app sits behind a proxy
Tim
TimOP12mo ago
Do you know if there is a complete list of ips that belong to railway that may be used?
Brody
Brody12mo ago
they would only be local ip address
Tim
TimOP12mo ago
As can by seen in my logs, and the linked thread, that is not the case. For example 35.204.95.109
Brody
Brody12mo ago
that's a gcp address, nothing to worry about there
Tim
TimOP12mo ago
Sure, but it seems undesirable that I either need to disable the allowed hosts security setting or that I need to whitelist arbitrary GCP hosts that pop-up in my logs to prevent my logs being filled with this error.
Want results from more Discord servers?
Add your server