使用www子域遗失了Google App Engine网址路径

时间:2012-03-07 00:39:38

标签: google-app-engine path dns subdomain url-routing

我刚将几个静态网站移到Google的App Engine上,如果您想使用自己的域名,则需要使用www子域名。两个域都正确路由,除了一个完整的URL路径不会传递到子域,除非在链接中键入或存在www;没有www,页面重定向回家。

工作站点 - 任一链接都可以工作:
http://www.synth.tk/daw/
http://synth.tk/daw/

问题网站 - 只有第一个链接可以工作;第二个重定向到主页:
http://www.carolyncaton.com/photos/
http://carolyncaton.com/photos/

根据Google的说明,使用以下主机记录使用FreeDNS设置这两个域:

 @  |   A   | 216.239.32.21
 @  |   A   | 216.239.34.21
 @  |   A   | 216.239.36.21
 @  |   A   | 216.239.38.21
www | CNAME | ghs.google.com

两者都使用以下app.yaml文件:

application: app-name-here
version: 1
runtime: python
api_version: 1

default_expiration: "30d"

handlers:

- url: /(.*\.css)
  mime_type: text/css
  static_files: static/\1
  upload: static/(.*\.css)

- url: /(.*\.html)
  mime_type: text/html
  static_files: static/\1
  upload: static/(.*\.html)
  expiration: "1h"

- url: /(.*\.js)
  mime_type: text/javascript
  static_files: static/\1
  upload: static/(.*\.js)

- url: /(.*\.eot)
  mime_type: application/vnd.ms-fontobject
  static_files: static/\1
  upload: static/(.*\.eot)

- url: /(.*\.(svg|svgz))
  mime_type: images/svg+xml
  static_files: static/\1
  upload: static/(.*\.(svg|svgz))

- url: /(.*\.ttf)
  mime_type: font/truetype
  static_files: static/\1
  upload: static/(.*\.ttf)

- url: /(.*\.woff)
  mime_type: application/x-font-woff
  static_files: static/\1
  upload: static/(.*\.woff)

- url: /(.*\.pdf)
  mime_type: application/pdf
  static_files: static/\1
  upload: static/(.*\.pdf)

# image files
- url: /(.*\.(bmp|gif|ico|jpeg|jpg|png))
  static_files: static/\1
  upload: static/(.*\.(bmp|gif|ico|jpeg|jpg|png))

# index files
- url: /(.+)/
  static_files: static/\1/index.html
  upload: static/(.+)/index.html
  expiration: "15m"

- url: /(.+)
  static_files: static/\1/index.html
  upload: static/(.+)/index.html
  expiration: "15m"

# site root
- url: /
  static_files: static/index.html
  upload: static/index.html
  expiration: "15m"

3 个答案:

答案 0 :(得分:1)

在Chrome中使用开发者控制台(F12,点击“保存登录导航”按钮),您可以看到http://carolyncaton.com/photos/获得了对http://www.carolyncaton.com/的302响应。由于App Engine不支持裸(apex)域,因此问题必须在其他地方。我建议您查看FreeDNS以获取类似“保留路径”的设置。

答案 1 :(得分:0)

Google Appengine不支持“裸域”,请参阅 http://code.google.com/intl/en/appengine/kb/general.html#naked_domain

答案 2 :(得分:0)

这两个网站现在似乎都有效。也许只需要一段时间就可以传播名称服务器更新。