russell.ballestrini.net/content/2014-05-08-nginx-with-ssl-and-mixed-content-errors-with-upstream-wsgi-servers.rst
russell@unturf.com 137d65cc65 Consolidate blog tags: 57 → 23 unique tags
- Fix case duplicates (guide→Guide, project→Project, etc.)
- Consolidate single-post tags into broader categories
- Add technology tags (Python, AWS, Salt, Docker, Kubernetes) to 93 posts
- Add lib/tag_stats.py tool for checking tag usage
- Update CLAUDE.md with tag guidelines
2026-01-26 09:09:53 -05:00

48 lines
1.2 KiB
ReStructuredText

Nginx with SSL and mixed content errors with upstream WSGI servers
##################################################################
:date: 2014-05-08 16:28
:author: Russell Ballestrini
:tags: Code, Guide, Python
:slug: nginx-with-ssl-and-mixed-content-errors-with-upstream-wsgi-servers
:status: published
Mixed content errors occur because Nginx (the front-end server)
communicates to the upstream WSGI server using http. WSGI does not know
(or care) about the SSL session between Nginx and the user. The WSGI
server will naively generate URIs and serve assets as http.
To fix mixed content errors, we need to communicate the inbound request
scheme or configure the WSGI server to always use https.
**waitress**
| Waitress is meant to be a production-quality pure-Python WSGI server
with very acceptable performance.
| It commonly powers Pyramid and Substance D deployments.
To configure waitress to always use https in code:
::
from waitress import serve
serve(wsgiapp, host='0.0.0.0', port=8080, url_scheme='https')
.. raw:: html
</p>
configure waitress to always use https in paste deploy compatible
configuration file:
::
[server:main]
host = 127.0.0.1
port = 6543
url_scheme = https
.. raw:: html
</p>
.. contents::