2014-10-29 19 views
1

我正在使用AWS的彈性beanstalk。我有一個我試圖部署到https的java/tomcat應用程序。我現在花了將近2天的時間嘗試通過非常小的成功實現https和運行。我所做的和我所看到的事情都發生了。ec2在443上沒有響應AWS豆杆

1. I bought and created a ssl certificate that I installed with my load balancer. 
2. I pointed 443 in load balancer security to 80 as the instructions stated and I've also tried pointing it to 443,8443,4443 
3. In my security group for my beanstalk instance, I enabled 443 to all external ips 
4. In beanstalk I turned on port 443 

現在,我真的很困惑。

1. As long as I don't try and secure my entire application, I'm able to get ssl working in my apps admin accounts without issue. The app will automatically redirect the protocol from http to https. 
2. Oddly enough I'm outputting the active port and no matter if I'm in http or https, the app is seeing the active port as 8080. How could this be if the load balancer is suppose to be using 443? Also, how would the ssl certificate work on port 8080 or is the ssl certificate working somehow on the load balancer side and the load balancer is doing some sort of port forwarding to the ec2 instance? 
3. If I attempt to secure the entire application doing a forced redirect to https from http. The app fails to load. I've tried redirecting to 443,8443,4443 without success. I need to do this redirect in order to tell google my pages have moved from 80 to 443. 

有人明白我正在發生什麼或者這是如何工作的?

回答

1

在你的應用環境點擊>>配置然後滾動下降到網絡層和編輯負載平衡屬性。

選擇443用於安全偵聽器端口,HTTPS用於協議,最後是您之前在負載均衡器中添加的認證。

enter image description here

要回答你的問題,你的SSL證書安裝在負載均衡器的端口轉發所有的流量從443到8080的服務器(或多個)上。在您的應用程序中強制使用443會破壞您的應用程序,因爲Elastic Beanstalk負載均衡器將轉發到端口8080,而不是443,因爲我懷疑您的應用程序正在偵聽。

+0

謝謝,你絕對正確。在實現負載均衡器將所有請求轉發到8080而不是基於URL協議的端口之後,我能夠在昨晚解決我的問題。 AWS需要更好地記錄該行爲。可能是一個不同的問題,但我不知道應用程序是如何區分頁面是否被認爲是安全的。例如,頁面a,具有一些鏈接的非安全頁面,其中一個鏈接指向安全頁面。在呈現頁面a時,如果一切都在http端口8080上完成,它如何知道指向安全頁面? – 2014-10-30 12:40:53