How do i get foo.somedomain.com get handled by myapp.appspot.com/foo on appengine

与世无争的帅哥 提交于 2019-12-05 02:40:59

问题


Here is what I'd like to achieve

http://foo.somedomain.com gets handled by http://myapp.appspot.com/foo (google appengine app myapp) and the underlying url is masked.

Note the following:

  • somedomain.com is a third party domain that would like to add foo.somedomain.com
  • mydomain.com would be CNAME'd to myapp.appspot.com
  • mydomain.com/foo would point to myapp.appspot.com/foo

other scenarios

  1. can foo.mydomain.com be made to point to myapp.appsot.com/foo
  2. can foo.somedomain.com point directly to myapp.appspot.com/foo

Added: myapp.appspot.com is developed using django w/ app-engine-patch


回答1:


You can't do this in the way described. In order to do this, you need to:

  1. CNAME foo.somedomain.com to ghs.google.com (not to myapp.appspot.com)
  2. Set up Google Apps for your Domain on somedomain.com, if it's not already
  3. Add the app 'myapp' to foo.somedomain.com through the Apps control panel

Once that's done, your app can check self.request.host to determine which hostname was sent, and route requests appropriately.




回答2:


You can parse the sub-domain from the Host header, then call the webapp.RequestHandler appropriate for the path /[sub-domain], assuming *.yourdomain.com is directed to the Google App Engine application.

Have a look at webapp.WSGIApplication and see if there's a way to get the mapped webapp.RequestHandler for a path. Alternatively, you might be able to modify the request object to change the requested path (this I'm not sure about, however.)




回答3:


This question was asked in one of the 2009 Google I/O app engine talks. Unfortunately the answer given was along the lines of not supported at this time but the possibilities of some workarounds may exist. 2009 Google I/O videos



来源:https://stackoverflow.com/questions/976127/how-do-i-get-foo-somedomain-com-get-handled-by-myapp-appspot-com-foo-on-appengin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!