如何在從http到https使用Amazon Elastic Beanstalk與PHP的同時重定向所有流量?我已經安裝我的Beanstalk有一個https端口(所有的證書和東西已經設置)。Elastic Beanstalk - PHP/Force HTTPS
4
A
回答
6
Beanstalk設置其負載平衡器,將X-Forwarded-Proto
標頭髮送給您的實例。
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] !== 'https') {
// redirect to secure site
header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
}
雖然,有些人會通過不啓用HTTP都發誓,在MITM攻擊使用,由於SSL stripping技術。
話雖如此,您可以通過使用HSTS減輕SSL剝離。
+1
只需一次更改它應該是$ _SERVER ['HTTP_X_FORWARDED_PROTO']而不是$ _SERVER ['X_FORWARDED_PROTO'] – 2013-02-24 12:04:51
+0
@ user1012013對不起,你絕對正確:) – 2013-02-24 12:06:08
1
如果你有一個實例彈性青苗環境,嘗試此解決方案:AWS Elasticbeanstalk single instance Force SSL Redirect loop
相關問題
- 1. Elastic Beanstalk Http重定向到Https
- 2. 從http重定向到https(Pencilblue Elastic Beanstalk)
- 3. AWS Elastic Beanstalk VPC - 從ELB到HTTPS實例
- 4. 使用Elastic Beanstalk重定向到Https ELB
- 5. 將http轉發到https - Elastic Beanstalk + Nginx
- 6. AWS Elastic Beanstalk中的https配置
- 7. Elastic Beanstalk和ES6
- 8. AWS + Elastic Beanstalk + MongoDB
- 9. Django Channels + Elastic Beanstalk
- 10. 瞭解Elastic Beanstalk?
- 11. Amazon Elastic Beanstalk Broadcast
- 12. Elastic Beanstalk上的SSL
- 13. Elastic Beanstalk上的SOLR
- 14. AWS Elastic Beanstalk和Composer
- 15. AWS Elastic Beanstalk和SQS
- 16. AWS EB CLI(elastic beanstalk)
- 17. Amazon Elastic Beanstalk without Git
- 18. AWS Elastic Beanstalk問題
- 19. AWS elastic beanstalk + Nginx + Gunicorn
- 20. Node.js deploy - AWS Elastic Beanstalk
- 21. AWS Elastic Beanstalk和JAVA_OPTS
- 22. WordPress與Elastic Beanstalk CLI
- 23. AWS Elastic Beanstalk緩存?
- 24. Cloudflare上SSL的Elastic Beanstalk
- 25. AWS Elastic Beanstalk Namecheap SSL配置
- 26. Travis CI與Amazon Elastic Beanstalk
- 27. AWS Elastic Beanstalk Rails Bundler失敗
- 28. 在Elastic BeansTalk,Tomcat,Nginx中將Http重定向到Https
- 29. 在Elastic Beanstalk上使用Node/Express重定向到HTTPS
- 30. AWS Elastic Beanstalk:通過HTTPS重定向主機名稱
你想要把所有的頁面到HTTPS? – 2013-02-24 11:30:25