1

Using this

request.url_root+ attributes["footer"]["district_link"]

in jinja on a page that is https:// gives me a url that has http:// which is causing problems. Is there a way to use this request that preserves this so it will be http:// on a page that uses http and https on a page that uses https?

The backend is using flask if that is relevant here

lathomas64
  • 1,612
  • 5
  • 21
  • 47

1 Answers1

0

Is your app proxied behind something like nginx?

If so you will need to use something like ProxyFix to add headers that include this information.

You can read more about proxy configuration in the flask docs on proxy setups.

Once you have ProxyFix working you can make use of the X-Forwarded-Proto header (for example). There's some more helpful info in this answer.

Rob Bricheno
  • 4,467
  • 15
  • 29