作者vinchen0102 (Wen)
看板Web_Design
標題[問題] ssl 無法連線
時間Sun Mar 9 18:41:07 2008
最近在看有關於java servlet 的書,看有關於security 的部分。
每次看到網頁當入會員的地方,網址都是https開頭,讓我對SSL 很有興趣,所以今天自己
試了一下。
我用的是 Apache Tomcat
在 \ROOT\WEB-INF\web.xml 裡面 加入了下面部分
<security-constraint>
<web-resource-collection>
<web-resource-name>
SecretProtection
</web-resource-name>
<url-pattern>
/login
</url-pattern>
<http-method>
GET
</http-method>
<http-method>
POST
</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>
manager
</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>
CONFIDENTIAL
</transport-guarantee>
</user-data-constraint>
</security-constraint>
基本上,是跟著書上寫的做。
書是學校圖書館借來的:Java servlet programming O'REILLY 的書
當我在網址打入
http://localhost:8080/login
後,網址會自動轉換成為
https://localhost:8443/login
但是,竟然出現了
Problem loading page
Unable to connect
Firefox can't establish a connection to the server at localhost:8443.
* The site could be temporarily unavailable or too busy. Try again in a
few
moments.
* If you are unable to load any pages, check your computer's network
connection.
* If your computer or network is protected by a firewall or proxy, make
sure
that Firefox is permitted to access the Web.
也就是說,根本連線不到,真的搞不清楚是什麼原因造成的。
把 web.xml 那段拿掉,那一頁又恢復正成了,只是沒有SSL。
但是我真的很想要用SSL...
我的問題是出在哪裡呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 219.90.187.87
→ mc18:我是用glassfish, web.xml不用改, 直接改用ssl port就可以 03/10 02:05
→ vinchen0102:意思是說 不要用tomcat 了嗎? 03/10 07:57
推 mc18:也不是XD我只是舉這個例子,因為我本身頗討厭湯姆貓的XD 03/10 16:16
→ mc18:沒啥特別原因XD不過由此可推論,湯母貓應該也是server設定問題 03/10 16:16