如何配置 Google App Engine app.yaml 文件以强制使用 https
How to configure Google App Engine app.yaml file to force https
如何强制所有 domain.tld 和 www.domain.tld to https://domain.tld?我能够接近。如果我通过注释行取消注释,它会强制执行所有操作,但我的静态文件夹中的所有内容都无法访问。
runtime: php74
env: standard
entrypoint: serve public/index.php
handlers:
#- url: /.*
# script: auto
# secure: always
# redirect_http_response_code: 301
- url: /static
static_dir: static
你需要这个:
runtime: php74
env: standard
entrypoint: serve public/index.php
handlers:
- url: /static
static_dir: static
- url: /.*
script: auto
secure: always
redirect_http_response_code: 301
顺序很重要,因为使用第一个匹配规则。
如何强制所有 domain.tld 和 www.domain.tld to https://domain.tld?我能够接近。如果我通过注释行取消注释,它会强制执行所有操作,但我的静态文件夹中的所有内容都无法访问。
runtime: php74
env: standard
entrypoint: serve public/index.php
handlers:
#- url: /.*
# script: auto
# secure: always
# redirect_http_response_code: 301
- url: /static
static_dir: static
你需要这个:
runtime: php74
env: standard
entrypoint: serve public/index.php
handlers:
- url: /static
static_dir: static
- url: /.*
script: auto
secure: always
redirect_http_response_code: 301
顺序很重要,因为使用第一个匹配规则。