HTTPS Redirection using Web.py

408 views Asked by At

I have a small demo application that I am trying to work on using web.py, to be hosted in Cloudfoundry, that will use the seeother function to redirect back to the home page after performing a certain operation in one of the Views.

However, the problem is when the seeother tries to return back to the home page, it uses the http url for redirection.

I forcefully don't want to code the https urls into the file and was wondering if there is an easy way to get around this problem ?

The web.ctx.protocol is returning http and so is wsgi.url_scheme

1

There are 1 answers

4
pbuck On

SeeOther is permitted to use a relative URI (RFC 7231), so you could do something like:

raise web.seeother('https:/home.html')

to return to home.html of the current host, but forcing https.