如何让 foo.somedomain.com 由 appengine 上的 myapp.appspot.com/foo 处理

发布于 2024-07-24 04:58:26 字数 652 浏览 5 评论 0原文

这是我想要实现的

http://foo.somedomain.com 的处理方式 http://myapp.appspot.com/foo(Google appengine 应用 myapp) 并且底层 url 被屏蔽。

请注意以下事项:

  • somedomain.com 是想要添加 foo.somedomain.com 的第三方域
  • mydomain.com 将 CNAME 到 myapp.appspot.com
  • mydomain.com/foo 将指向 myapp.appspot.com/ foo

其他场景

  1. 可以使 foo.mydomain.com 指向 myapp.appsot.com/foo
  2. 可以 foo.somedomain.com 直接指向 myapp.appspot.com/foo

添加: myapp.appspot.com 是使用 django w/ 开发的应用程序引擎补丁

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

橘香 2024-07-31 04:58:26

您不能按照所描述的方式执行此操作。 为此,您需要:

  1. 将 foo.somedomain.com CNAME 更改为 ghs.google.com(而不是 myapp.appspot.com)
  2. 在 somedomain.com 上为您的域设置 Google Apps(如果尚未
  3. 添加)添加应用程序通过应用程序控制面板将“myapp”发送到 foo.somedomain.com

完成后,您的应用程序可以检查 self.request.host 以确定发送了哪个主机名,并适当地路由请求。

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.

想你的星星会说话 2024-07-31 04:58:26

您可以从 Host 标头解析子域,然后调用适合路径 /[sub-domain]webapp.RequestHandler,假设 *.yourdomain.com 定向到 Google App Engine 应用程序。

查看 webapp.WSGIApplication 并查看是否有办法获取路径的映射 webapp.RequestHandler。 或者,您也许可以修改请求对象来更改请求的路径(但是我不确定。)

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.)

深者入戏 2024-07-31 04:58:26

这个问题是在 2009 年 Google I/O 应用引擎演讲之一中提出的。 不幸的是,给出的答案是目前不支持,但可能存在一些解决方法的可能性。 2009 Google I/O 视频

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文