Mathics3/mathics-omnibus

Invalid HTTP_HOST header

MohamedElashri opened this issue · 7 comments

Hello

There is a problem with using the docker image on any public instance. You will get an error like that.

Invalid HTTP_HOST header: '<ip>:8000'. You may need to add '<ip>' to ALLOWED_HOSTS.
Bad Request: /

I think you will need a way to specify ALLOWED_HOSTS = ['*'] in Django settings.py by default if we are using docker.

@MohamedElashri how did you setup the instance?

I did it via
docker run --rm -it --name mathics-web -p 8000:8000 -v /tmp:/usr/src/app/data mathicsorg/mathics --mode ui

rocky commented

Ok - thanks for the information. I guess we need to change the Django side .

I will try to get this all fixed up within a week or so

rocky commented

@MohamedElashri Mathics-django master at Mathics3/mathics-django@ab98c70 has been updated to allow setting ALLOWED_HOSTS via an environment variable. Please try it when you get a chance.

What remains here is just to allow passing new environment variables through.

Hello, That's great. However, this problem comes with docker, so we need to allow passing new environment variables (and build the image) before it can be tested.

rocky commented

I had intended to look at this, but I might not be able to get around to this. This kind of thing is pretty straightforward to add, and the existing code has a pattern to follow. Also, this is open-source code which means anyone can contribute.

Maybe you can try adding and putting in a PR?

(A trepidation I have here though is that the API is a little unstable right now - so fixing this up just might open the flood gates for that, unless you work with the last packaged versions)

rocky commented

@MohamedElashri - Please let me know if #12 fixes things with the current master of Mathics Django.