Laravel应用程序中Google App Engine上的Https重定向问题

时间:2019-02-06 14:38:50

标签: google-app-engine redirect laravel-5 https

我在Google App引擎上有laravel(v5.6)应用程序。

如何从http重定向到https?

1 个答案:

答案 0 :(得分:1)

在App Engine标准中:

在您的app.yaml处理程序中使用secure: always元素。

引用App Engine standard app.yaml reference documentation

  

与不使用HTTPS的此处理程序匹配的URL请求将自动重定向到具有相同路径的HTTPS URL。保留查询参数以进行重定向。

handlers:
- url: /youraccount/.*
  script: auto
  secure: always


在App Engine Flexible中:

在这种情况下,由于App Engine Flexible不支持处理程序,因此您需要从应用程序内重定向到HTTPS。

看看this document

  

安全处理程序:

     

在App Engine灵活环境中,secure下的handlers设置已被弃用。如果需要SSL重定向,则可以更新应用程序代码并使用X-Forwarded-Proto标头重定向http流量。您也可以使用HTTP Strict Transport Security response header