Golang, Heroku – 如何检查请求是否为 HTTPS

huangapple go评论84阅读模式
英文:

Golang, Heroku - How to check if request is https

问题

文档建议您可以在请求对象上检查TLS,但在Heroku上,它似乎为nil。

英文:

Documentation suggests you can check TLS on the request object, but that appears to be nil (on heroku at least).

答案1

得分: 6

根据Heroku文档的说明,HTTPS在您的应用程序上游被终止。

请检查请求的Headers中是否有一个名为X-Forwarded-Proto的头部,其值为https

英文:

Looking at the Heroku documentation, it appears that HTTPS is terminated upstream of your application.

Check the request's Headers for a X-Forwarded-Proto header with the value https.

huangapple
  • 本文由 发表于 2014年8月25日 23:17:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/25489129.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定