如何配置谷歌应用引擎App.yaml文件以强制https



如何强制所有domain.tld和www.domain.tldhttps://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

顺序很重要,因为使用了第一个匹配规则。

最新更新