語境Java密鑰
我需要把Java應用程序服務器(HTTP端口8080,HTTPS 8181)背後IIS 7.5(http端口80,HTTPS 443)在Windows Server 2008上
步驟
我已使用IIS ARR
模塊啓用代理,以便將某些請求路由到Java應用程序服務器。我也爲此目的創建了一些URL Rewrite
規則。使用http
,一切工作正常。
使用的規則規定,當請求的URL匹配(MyAppContextRoot.+)
模式時,要採取的操作是Rewrite:http://localhost:8080/{R:0}
。
對於使用https另一個應用程序,重寫規則是:https://localhost:8181/{R:0}
。
爲了路由HTTPS請求,我讀的地方,我需要共享IIS和Java之間的相同的證書,因爲IIS加密/解密的請求/應答。糾正我,如果我錯了。
由於我還處於發展階段,我決定分享自簽名證書。我曾與SelfSSL7
創建它,我一直在使用keytool
導入的Java keystore
:
selfSSL7 /Q /T /I "Default web site" /N cn=myDomain.com /X /F MyCertificate.pfx /W myPassword
keytool -importkeystore -srckeystore C:\myPath\MyCertificate.pfx -srcstoretype pkcs12 -srcalias my -deststoretype jks -deststorepass myPassword -destalias MyAlias
問題
兩個證書做他們的工作:https://myDomain.com
和https://myDomain.com:8181
被啓動和運行,而是試圖路由時,我得到的錯誤:
502 - Web server received an invalid response while acting as a gateway or proxy server.
There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.
看着證書,但是,有差異在:I ssued,簽名,有效性,簽名算法,密鑰大小。特別是,由SelfSSL7創建的算法的算法是sha1RSA(1024位密鑰),而由keytool創建的算法是sha256RSA(2048位密鑰)。
'keytool -importkeystore'只會複製證書(和私鑰)。如果作爲客戶端連接時證書詳細信息有所不同,那麼您可能沒有使用您認爲的證書配置服務器。 – Bruno