Hi there, PythonAnywhere developer here. I assume that the request environment where Jim S was seeing the incorrect http_host is the underlying WSGI environment -- is that correct? If so, that's a weird result. We definitely don't do anything strange and hacky with those headers; I just ran a test app to confirm and it was set to the correct domain -- that is, I saw the correct http_host, and the http_referer was unset.
Jim, perhaps you could point me at the app that had that error? Is there any chance that you'd set up a non-CNAME redirect at your DNS provider? I know that Joker (our one) offers not just CNAMEs but "Web-redirects", which just does an HTTP redirect to the name you provide. Perhaps your provider confuses the two in their interface? Just for clarity: the link through to the username.pythonanywhere.com domain works purely at the DNS level. We need to be able to move web apps from IP address to IP address for load balancing, so we ask our customers to set up their domain with a CNAME to username.pythonanywhere.com with their DNS provider. But that's just a DNS thing; by the time a request from a browser gets to our servers, it's just to a specific IP address, with the appropriate Host: header in the HTTP request. There should definitely be no weird redirects going on; requests are routed to the appropriate WSGI app based entirely on the hostname provided in the HTTP request, and while that routing knows about which user's sandbox the request should be routed to, it knows nothing about the username.pythonanywhere.com domain. All the best, Giles On Tuesday, February 12, 2013 4:07:19 PM UTC, Jim S wrote: > > Yes, might be a show-stopper for me and others trying to use > pythonanywhere. I was thinking there were others on the list using > pythonanywhere successfully with web2py. My problem is I know little about > DNS and routing. My DNS is hosted by mydomain.com. There is also a good > chance that I've got something screwed up there too... > > -Jim > > On Tuesday, February 12, 2013 9:58:11 AM UTC-6, Jonathan Lundell wrote: >> >> On 12 Feb 2013, at 7:48 AM, Jim S <j...@qlf.com> wrote: >> >> Looking at request.env I'm seeing the following: >> >> http_host = myaccountname.pythonanywhere.com >> http_referer = http://www.myappurl.com >> >> I'm routing in my routes.py based on www.myappurl.com but it never goes >> there. It is always going to myaccountname.pythonanywhere.com. >> >> >> Interesting. That seems like a real hack on the part of Python Anywhere, >> and not just because of this problem, but also because you have no idea >> what the real referrer is. Lots of analytics tools depend on that. >> >> >> -Jim >> >> On Tuesday, February 12, 2013 9:25:27 AM UTC-6, Jim S wrote: >>> >>> So you mean to just look at it through a regular view, not in the >>> routes.py. Got it. Wasn't thinking straight. >>> >>> -Jim >>> >>> On Monday, February 11, 2013 11:13:23 PM UTC-6, Jonathan Lundell wrote: >>>> >>>> On 11 Feb 2013, at 7:48 PM, Jim Steil <ato....@gmail.com> wrote: >>>> >>>> Sorry for being slow at this, route configuration is certainly not a >>>> forte of mine. Is there something special I need to do to turn on >>>> logging? >>>> How would I examine request.env? I'm running all of this from >>>> pythonanywhere and don't really know where to find these things. >>>> >>>> >>>> >>>> =BEAUTIFY(request) or =BEAUTIFY(request.env) should do the trick. >>>> >>>> Logging depends on your deployment, but it's worth figuring out. Look >>>> at logging.example.conf. You can set the loglevel of routing in routes.py. >>>> >>>> It's really too bad that logging is such a pain to get configured, >>>> because it's really valuable. >>>> >>>> >>>> -Jim >>>> >>>> On Mon, Feb 11, 2013 at 9:06 PM, Jonathan Lundell <jlun...@pobox.com>wrote: >>>> >>>>> On 11 Feb 2013, at 7:01 PM, Jim S <j...@qlf.com> wrote: >>>>> >>>>> Jonathan >>>>> >>>>> I am currently using that as my base for getting this working. Here >>>>> is what I have so far: >>>>> >>>>> routers = dict( >>>>> # base router >>>>> BASE=dict(domains = {"www.website1.com":"mustangs", >>>>> "www.website2.com":"icysa", })) >>>>> >>>>> But, anytime I to either URL, I get the web2py welcome app. >>>>> >>>>> Also, I've saved the file as routes.py. >>>>> >>>>> >>>>> And restarted, right? >>>>> >>>>> Try turning on logging for routes and see what you get. You might also >>>>> examine request.env, and make sure that the target domain is showing up >>>>> properly. >>>>> >>>>> >>>>> -Jim >>>>> >>>>> On Monday, February 11, 2013 6:32:41 PM UTC-6, Jonathan Lundell wrote: >>>>>> >>>>>> On 11 Feb 2013, at 3:36 PM, Jim S <j...@qlf.com> wrote: >>>>>> >>>>>> I'm trying to route traffic that comes in on a specific URL to a >>>>>> specifc app. >>>>>> >>>>>> Example: >>>>>> >>>>>> www.host1.com should route to the welcome app >>>>>> >>>>>> www.host2.com should route to mySpecific app >>>>>> >>>>>> I realize this is probably trivial, but I'm really struggling with >>>>>> it. Hoping to do it with routes.py and not through wsgi stuff. Please >>>>>> feel free to set me straight if that is not advisable. >>>>>> >>>>>> >>>>>> Look at the domain-routing provision in the parametric router. >>>>>> Documentation in the book, and in router.example.py. >>>>>> >>>>> >>>>> -- >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> >>>>> >>>> >>>> >>>> >>>> >> -- >> >> >> >> >> >> -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.