-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Support changing the baseURL for ProxySupport #229
base: master
Are you sure you want to change the base?
Conversation
@@ -37,6 +37,9 @@ def get_bool_from_environment(env_var: str, default_value: str): | |||
# Use Django's default value for ALLOWED_HOSTS. | |||
ALLOWED_HOSTS = [] | |||
|
|||
# Support changing the Base URL | |||
BASE_URL = os.environ.get("MATHICS_DJANGO_URL", None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value needs to be a string type. On line 166 below, among other places, there is the use of string concatenation "+": BASE_URL+"/media"
.
BASE_URL = os.environ.get("MATHICS_DJANGO_URL", None) | |
BASE_URL = os.environ.get("MATHICS_DJANGO_URL", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you do me a favor and try this out in a non-proxy environment with MATHICS_DJANGO_URL
unset?
I wonder if the non-absolute URLs in that environment still work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value needs to be a string type. On line 166 below, among other places, there is the use of string concatenation "+":
BASE_URL+"/media"
.Suggested change
BASE_URL = os.environ.get("MATHICS_DJANGO_URL", None) BASE_URL = os.environ.get("MATHICS_DJANGO_URL", "")
Ok, I'm not a python dev so but like this I'll miss... Will fix this when I get a chance.
Would you do me a favor and try this out in a non-proxy environment with
MATHICS_DJANGO_URL
unset?I wonder if the non-absolute URLs in that environment still work.
I'll test it either tomorrow (Fri) or Monday.
I suspect my changes are maybe a bit harsh and I suspect might kill the about page if it's not got .html appended.
The main issue is the way browers treat relative Vs absolute URLs and how django reads the URL back in. If I could control the proxy better then I could add a rewrite line but that's contained.
See issue - #228
This (probably terrible) change will allow you to use the env variable "MATHICS_DJANGO_URL" to support serving the files from a different BASE_URL.
This meant we could serve the application via a proxy, we were using "Open OnDemand" with a proxy configuration we couldn't change and also dynamic proxy addresses.