I have a project started with Cookiecutter Django and I'm currently adding WeasyPrint to serve some views as PDF files. This is working fine on development. Cookiecutter Django is using Caddy as the HTTP server. I'm having errors on production due I can't access to files through its absolute URL from inside the Django docker instance.
From inside the Django docker instance, this does not work:
$ curl https://myowndomain.com
curl: (7) Failed to connect to myowndomain.com port 443: Connection timed out
But this does:
$ curl https://www.google.com
From outside the Django docker instance both curl commands are working OK.
My Caddyfile:
myowndomain.com {
proxy / django:5000 {
header_upstream Host {host}
header_upstream X-Real-IP {remote}
header_upstream X-Forwarded-Proto {scheme}
except /media
transparent
}
log stdout
errors stdout
gzip
header / {
# Don't show Caddy/Gunicorn as server header.
-Server
# Enable HTTP Strict Transport Security (HSTS) to force clients to always connect via HTTPS (do not use if only testing)
Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
# Only send Referer header to same origin.
# Django CSRF protection is incompatible with referrer policy set to none.
Referrer-Policy "same-origin"
# Enable cross-site filter (XSS) and tell browser to block detected attacks.
X-XSS-Protection "1; mode=block"
# Prevent some browsers from MIME-sniffing a response away from the declared Content-Type
X-Content-Type-Options "nosniff"
}
}
Is there something I need to set? Am I missing something?