Google engine redirects to absolute uri

I use the Google engine to work with python and webapp2, and I cannot find a way to simply redirect to an external website using an absolute uri.

For instance:

class Landing(BaseHandler): def get(self): self.render("landing.html") def post(self): name=self.request.get("name") if name == "yes" self.redirect("/") else: self.redirect("http://example.com") **This is the problem as I want to redirect to an absolute url. 

Self.redirect always redirects to a relative URL. How can I redirect to an absolute URL? I think it should be easy, but I can’t find a way.

+4
source share
2 answers

Works fine for me, not just redirecting to relative url. Check host, browser, and caching configurations.

GAE just redirected me to example.com using it on my dev and production server

Take care though this example.com redirects to http://www.iana.org/domains/example/

This may confuse you.

Try using, for example, self.redirect("http://www.facebook.com") . This will redirect you to facebook. Plain.

+2
source

Also .. I think I may have been bitten by the fact that there is no return in your code - so even after you have called the self.redirect (...) bit if you write something else for yourself that can ruin your forwarding.

+1
source

All Articles