英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论