我正在嘗試對(duì) Google Cloud AppEngine 上托管的應(yīng)用程序的所有流量強(qiáng)制使用 https。https 可以工作,但盡管遵循將 http 流量重寫為 https 的說明,但仍然可以使用 http 訪問該站點(diǎn),這會(huì)導(dǎo)致問題。我已將其添加到 app.yaml 中:handlers:
- url: /.*
script: _go_app
secure: always
redirect_http_response_code: 301但似乎沒有什么區(qū)別。我正在使用 julienschmidt 路由器,然后使用它來處理所有路由:log.Fatal(fmt.Println(http.ListenAndServe(":8080", router)))我已經(jīng)考慮過使用 http.ListenAndServeTLS 但這需要額外的參數(shù),并且我無法計(jì)算出這些值在 Google AppEngine 上下文中應(yīng)該是什么。log.Fatal(fmt.Println(http.ListenAndServeTLS(":8443", "cert.pem", "key.pem", router)))“cert.pem”和“key.pem”在哪里?我讀過,我不需要在我的應(yīng)用程序中顯式提供 TLS,因?yàn)?AppEngine 會(huì)為我處理它,所以即使我知道參數(shù)是什么,我也不確定它是否有助于強(qiáng)制使用https。http://sapling.appspot.comhttps://sapling.appspot.comhttp://sapling.moneyhttps://sapling.money上述所有工作都有效,但我似乎無法將任何一個(gè) http 版本強(qiáng)制為 https。
- 0 回答
- 0 關(guān)注
- 161 瀏覽
添加回答
舉報(bào)
0/150
提交
取消