-
Hi, there are several similar questions out there, but I haven't found one that covers gunicorn and nginx specifically. I'm having the same problem as others, where the url_for function in a Jinja2 template is returning an HTTP URL, but my production website uses HTTPS, so the content is blocked by most browsers for being potentially insecure. As I understand it, the solution is to add Snippet of my nginx setup:
Snippet of my gunicorn unit: This is not working for me, however. I'm still getting url_for returning HTTP URLs. I thought the FastAPI/Jinja2/nginx/gunicorn stack was fairly common, so I'm just looking for confirmation that someone has achieved what I am trying to do. If you are using this stack and have successfully gotten an HTTPS scheme out of url_for, can you let me know what you did? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Ope, I'm guessing the reason there are not any specific questions about this stack are because I made it more complicated than it needed to be. I don't even need to use |
Beta Was this translation helpful? Give feedback.
Ope, I'm guessing the reason there are not any specific questions about this stack are because I made it more complicated than it needed to be. I don't even need to use
url_for
in my Jinja2 template; I can just hardcode the path to the static directory with a slash in front of it, like<script src="/static/js/compiled_js/my_js.js"></script>
. I'm still not sure how to get url_for to work, but I'm going to close this because it's not necessary for my use case.