domains.$domain.report.url starts with http://
Should be https://
Related code:
|
result["report"] = {"url": f"{site_url}{reverse(url_name, args=args)}"} |
which uses:
|
def get_site_url(request): |
|
""" |
|
Compose the url that the user used to connect to the API. |
|
|
|
""" |
|
return f"{request.scheme}://{request.get_host()}" |
But it probably does not have a real request context as a task, so the scheme defaults to http?
|
@batch_shared_task(bind=True, ignore_result=True) |
|
def batch_async_generate_results(self, user, batch_request, site_url): |
If it would be a real request, the following holds:
Because nginx is terminating the TLS, it sets a proxy header X-Forwarded-Proto with $scheme:
|
proxy_set_header X-Forwarded-Proto $scheme; |
This requires that SECURE_PROXY_SSL_HEADER is set, which is conditionally set:
|
if DJANGO_IS_PROXIED: |
|
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") |
which is fetched by:
|
DJANGO_IS_PROXIED = get_boolean_env("DJANGO_IS_PROXIED", False) |
and by default set on True:
The relevant Django 4.2.x code is here:
https://github.com/django/django/blob/stable/4.2.x/django/http/request.py#L246-L270
domains.$domain.report.urlstarts withhttp://Should be
https://Related code:
Internet.nl/interface/batch/util.py
Line 310 in 77dde1c
which uses:
Internet.nl/interface/batch/util.py
Lines 165 to 170 in 77dde1c
But it probably does not have a real request context as a task, so the scheme defaults to
http?Internet.nl/interface/batch/util.py
Lines 244 to 245 in 77dde1c
If it would be a real request, the following holds:
Because nginx is terminating the TLS, it sets a proxy header
X-Forwarded-Protowith$scheme:Internet.nl/docker/webserver/nginx_templates/app.conf.template
Line 156 in 77dde1c
This requires that
SECURE_PROXY_SSL_HEADERis set, which is conditionally set:Internet.nl/internetnl/settings.py
Lines 602 to 603 in 77dde1c
which is fetched by:
Internet.nl/internetnl/settings.py
Line 48 in 77dde1c
and by default set on
True:Internet.nl/docker/compose.yaml
Line 137 in 77dde1c
The relevant Django 4.2.x code is here:
https://github.com/django/django/blob/stable/4.2.x/django/http/request.py#L246-L270