Fix Django DisallowedHost / ALLOWED_HOSTS on seenode | Seenode Docs

Fix Django DisallowedHost / ALLOWED_HOSTS on seenode

Django returns 'DisallowedHost' on seenode until you add your domain to ALLOWED_HOSTS. Here's the fix.

The error

Your Django app returns an error like:

DisallowedHost at /
Invalid HTTP_HOST header: 'your-app.seenode.app'. You may need to add
'your-app.seenode.app' to ALLOWED_HOSTS.

Quick fix

Add your service’s hostname to Django’s ALLOWED_HOSTS. Read it from an environment variable so you don’t hard-code it:

import os
ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "").split(",")

Then set an ALLOWED_HOSTS environment variable on the service to a comma-separated list of your domains, for example:

your-app.seenode.app,example.com,www.example.com

Redeploy for the change to take effect.

Why this happens

Django rejects requests whose Host header isn’t in ALLOWED_HOSTS, as a security measure. Your seenode URL (and any custom domain) must be listed.

Checklist

  • ALLOWED_HOSTS includes your *.seenode.app URL and every custom domain.
  • The variable is set on the service and you redeployed.
  • Entries are hostnames only, no https:// scheme or paths.