在使用Glassfish之前使用Apache http服务器的build议(检查问题 )之后,我使用了以下教程并使其工作,但仅在端口80上工作。
我的意思是现在我可以键入:
www.mydomain.com
它运行。 但是,如果我运行一个需要https的应用程序,即在web.xml(一个J2EE应用程序)
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
当我键入:
www.mydomain.com
它会自动加载:
https://www.mydomain.com:8181
我不想显示端口8181,我只想: https : //www.mydomain.com 。
PS:我将只使用在“/”上下文中运行的一个应用程序 。
以下是我的configuration:
* workers.properties文件:
worker.list=ajp13unsecure, ajp13secure worker.ajp13unsecure.type=ajp13 worker.ajp13unsecure.host=localhost worker.ajp13unsecure.port=8009 worker.ajp13secure.type=ajp13 worker.ajp13secure.host=localhost worker.ajp13secure.port=8009
*我添加的httpd.conf文件:
Listen 443 # Load mod_jk module # Update this path to match your modules location LoadModule jk_module modules/mod_jk.so # Where to find workers.properties # Update this path to match your conf directory location (put workers.properties next to httpd.conf) JkWorkersFile conf/workers.properties # Where to put jk logs # Update this path to match your logs directory location (put mod_jk.log next to access_log) # This can be commented out, to disable logging JkLogFile logs/mod_jk.log # Set the jk log level [debug/error/info] # Only matters if JkLogFile is being used. JkLogLevel debug # Select the timestamp log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " # JkOptions indicate to send SSL KEY SIZE JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories # JkRequestLogFormat set the request format JkRequestLogFormat "%w %V %T" # Send everything for context /examples to worker named worker1 (ajp13) # /examples would most likely be the name of your WebApp (c:/tomcat/webapps/example) JkMount /* ajp13secure # Should mod_jk send SSL information (default is On) JkExtractSSL On # What is the indicator for SSL (default is HTTPS) JkHTTPSIndicator HTTPS # What is the indicator for SSL session (default is SSL_SESSION_ID) JkSESSIONIndicator SSL_SESSION_ID # What is the indicator for client SSL cipher suit (default is SSL_CIPHER) JkCIPHERIndicator SSL_CIPHER # What is the indicator for the client SSL certificated? (default is SSL_CLIENT_CERT) JkCERTSIndicator SSL_CLIENT_CERT
问题:
我错过了什么,以便端口8181不再出现在URL中?
也正如我所说SSL证书已经安装在玻璃鱼,我必须安装它在Apache或其确定吗?
PS:我正在使用
这是由您的应用程序发出的强制您通过SSL连接的redirect的结果。 问题是,因为glassfish现在是代理的背后,应用程序不知道它运行的端口不是人们应该使用的端口。 某处应该有configuration来覆盖要使用的端口。
这个特定问题的简单解决scheme是使用Apache而不是Java来处理强制用户使用SSL,您可以使用mod_rewrite来完成这项工作:
RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
也就是说,真正的解决scheme是找出URLredirect来自哪里以及可以做些什么来重新configuration它。 这个问题可能会在您的应用创buildurl的其他地方显示,例如用户注册电子邮件。
(免责声明:关于Glassfish / J2EE /所有这些小小的Java位如何组合在一起,我一无所知,所以我不确定在这个堆栈中究竟是在构build这个URL还是你必须修改它来修复它)