简体   繁体   English

用httpd和tomcat实现SSL的问题

[英]issues with implementing SSL with httpd & tomcat

In our live env, we have tomcat behind apache. 在我们的现场环境中,我们在Apache后面拥有tomcat。 we recently purchased an SSL certificate and installed it on apache. 我们最近购买了SSL证书并将其安装在apache上。

i want to secure all the communication with https. 我想通过https保护所有通信。

What happens is https://{HOST}/{WEBAPP} returns a login page. https:// {HOST} / {WEBAPP}返回登录页面会发生什么。 But after successful login the URL in the browser shows http link again. 但是成功登录后,浏览器中的URL再次显示http链接。 So next requests are back to http. 因此,下一个请求返回到http。 How do i ensure that all requsts are on https always. 我如何确保所有要求始终在https上。

mod_proxy & mod_jk are used in apache config. mod_proxy和mod_jk在apache配置中使用。 also following is present in the config: 配置中还存在以下内容:

ProxyPass / http://{localhost}:12004/ ProxyPass / http:// {localhost}:12004 /
ProxyPassReverse / http://{localhost}:12004/ ProxyPassReverse / http:// {localhost}:12004 /
ProxyPreserveHost On ProxyPreserveHost开启

i read lots of articles and questions but none seem to make sense to me for this problem. 我读了很多文章和问题,但是对于这个问题,我似乎都没有意义。 May be it is due to my little understanding about this config. 可能是由于我对此配置的了解不足。

please help. 请帮忙。

Providing the every request that httpd sends to Tomcat has been received by httpd over SSL then you need to make some adjustments to the HTTP connector in Tomcat. 如果httpd通过SSL接收到httpd发送给Tomcat的每个请求,那么您需要对Tomcat中的HTTP连接器进行一些调整。 You'll need to set the following attributes: 您需要设置以下属性:

scheme="https" secure="true" SSLEnabled="false"

The last one isn't strictly necessary but it is better to be explicit. 最后一个不是严格必要的,但最好是明确的。 It is worth repeating that this only works if a) all the requests are received via httpd and b) all requests proxied to Tomcat are received via https. 值得重复的是,只有当a)所有请求均通过httpd接收到,b)代理到Tomcat的所有请求均通过https接收时,这才有效。

You will need something like the re-write configuration in Sibin Grasic's answer in your http virtual host to redirect the Tomcat traffic to https. 您将需要类似HTTP虚拟主机中Sibin Grasic的答案中的重写配置之类的内容,以将Tomcat通信重定向到https。 Then in your https virtual host you can add you mod_proxy directives. 然后,可以在https虚拟主机中添加mod_proxy指令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM