我的 中有以下处理程序部分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
GAE 上的参考,没有提到类型映射中http_header
指令的限制。script