Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DJANGO_ALLOWED_HOSTS limited to listing one extra host/domain #548

Closed
cboylan opened this issue Aug 16, 2022 · 3 comments
Closed

DJANGO_ALLOWED_HOSTS limited to listing one extra host/domain #548

cboylan opened this issue Aug 16, 2022 · 3 comments

Comments

@cboylan
Copy link
Contributor

cboylan commented Aug 16, 2022

Tag/version of Container Images
0.4.* but I believe 0.3.* is also affected

Currently DJANGO_ALLOWED_HOSTS is retrieved directly from the environment. This seems to limit us to setting a single host/domain in that environment variable because ALLOWED_HOSTS expects a different python list entry for each allowed host.

In our current proof of concept installation we are trying to deploy a single mailman 3 installation with vhosts for different list domains. In order to make that work with DJANGO_ALLOWED_HOSTS I had to modify settings.py like this:

django_allowed_hosts = os.environ.get('DJANGO_ALLOWED_HOSTS')
if django_allowed_hosts:
    ALLOWED_HOSTS.extend(django_allowed_hosts.split(':'))

The split on : is somewhat arbitrary and may be a bad choice as it would conflict with ipv6 addresses.

It does seem like something like this is necessary to support adding multiple allowed hosts via DJANGO_ALLOWED_HOSTS? Another approach would be to avoid this env var entirely and append to ALLOWED_HOSTS in our settings_local.py file. Reporting this as it seems this env var doesn't currently work as expected. I'm happy to submit a pull request too if we can agree on a good way to address this.

@cboylan cboylan added the bug label Aug 16, 2022
@joergmschulz
Copy link
Contributor

when we want to get all configuration into the docker-compose.yml, your approach points into a good direction - ALLOWED_HOSTS should be added to the settings_local.py during container startup using web/docker-entrypoint.sh

@maxking
Copy link
Owner

maxking commented Jan 6, 2023

I have seen comma (,) being used as a delimiter in such cases and it would probably not break existing values either, so I am okay with adding that. Would you be interested to open a PR for that?

@maxking maxking changed the title [BUG] DJANGO_ALLOWED_HOSTS limited to listing one extra host/domain DJANGO_ALLOWED_HOSTS limited to listing one extra host/domain Jan 6, 2023
@maxking
Copy link
Owner

maxking commented Jul 7, 2023

Fixed by #638

@maxking maxking closed this as completed Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants