【发布时间】:2016-09-17 07:36:45
【问题描述】:
我的app.yaml 中有以下处理程序部分:
handlers:
- url: /(robots\.txt|sitemap\.xml)
static_files: \1
upload: (robots\.txt|sitemap\.xml)
secure: always
http_headers:
Strict-Transport-Security: 'max-age=63072000; includeSubDomains; preload'
- url: /.*
script: main.app
secure: always
http_headers:
Strict-Transport-Security: 'max-age=63072000; includeSubDomains; preload'
由另一个子模块 (static.yaml) 提供服务的另一个子域具有以下内容:
handlers:
- url: /
static_dir: files
secure: always
http_headers:
Access-Control-Allow-Origin: '*'
Strict-Transport-Security: 'max-age=63072000; preload'
我能够部署 static.yaml,而对 appengine 没有任何问题:
$ appcfg.py update static.yaml
12:48 PM Host: appengine.google.com
12:48 PM Application: XXXXXX; module: static; version: 1
12:48 PM
Starting update of app: XXXXXXXX, module: static, version: 1
12:48 PM Getting current resource limits.
12:48 PM Scanning files on local disk.
[...]
[...]
12:49 PM Checking if updated app version is serving.
12:49 PM Completed update of app: XXXXXX, module: static, version: 1
然而,当我尝试更新 app.yaml 配置时,我得到:
$ appcfg.py update app.yaml
12:48 PM Host: appengine.google.com
Usage: appcfg.py [options] update <directory> | [file, ...]
appcfg.py: error: Error parsing .\app.yaml: Unexpected attribute "http_headers" for mapping type script.
in ".\app.yaml", line 31, column 1.
我知道这意味着我必须在我的 python 脚本本身中处理 HSTS 配置。但是,我在 main.app 接口中有大约 10 个处理程序。除了更新其中的每一个来添加 STS 标头之外,还有其他方法可以在 app.yaml 级别本身这样做吗?
查看app.yaml reference on GAE,在script类型映射中没有提到http_header指令的限制。
【问题讨论】:
标签: google-app-engine https http-headers app.yaml hsts