处理的X转发-PROTO在java中的apache-tomcat的 [英] Handling X-FORWARDED-PROTO in java apache-tomcat

查看:788
本文介绍了处理的X转发-PROTO在java中的apache-tomcat的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何一个可以指导我在Java的Apache,Tomcat的的X转发-PROTO工作。

Can any one guide me in working with X-FORWARDED-PROTO in Java apache-tomcat.

应用程序的设置是这样的方式与Apache网络服务器,它与思科负载平衡器反过来谈判,终于平衡器发布页面到客户端的tomcat会谈(Tomcat的 - >的Apache2 - >负载平衡器 - >客户端)。

The application setup is in such a way that tomcat talks with apache webserver, which in turn talks with Cisco LoadBalancer, finally the balancer publishes the pages to the client (tomcat -> apache2 -> load balancer -> client).

SSL证书安装在负载平衡器和其处理HTTPS请求。我的要求是使该应用程序以这样的方式表现,它使用的X转发-原型和更改页作为HTTP或HTTPS。

The SSL Certificate is installed in LoadBalancer and its handling https request. My requirement is to make the application behave in such a way that it uses the X-FORWARDED-PROTO and change the pages as HTTP or HTTPS.

检查我的网页的头文件我找不到的X转发-PROTO参数。我没有访问负载平衡器配置,使用,以及IT部门建议我们使用X-转发-PROTO之间的HTTP和放大器来区分; HTTPS请求。

Checking on the header files of my webpages i could not find the X-FORWARDED-PROTO parameter. I don't have access to the LoadBalancer configuration either, and the IT has suggested us to use the X-FORWARDED-PROTO to differentiate between HTTP & HTTPS request.

是否有Tomcat或Apache的水平上进行,这样它会返回的X转发-PROTO参数的任何配置。抑或是它的配置应该在负载平衡器处理。

Is there any configuration to be done in tomcat or apache level so that it will return the X-FORWARDED-PROTO parameter. Or is it that the configuration should be handled in LoadBalancer .

推荐答案

我是pretty确保你拥有这一切,现在想通了通过,但我仍然会增加答案。

I am pretty sure you have it all figured out by now but I will add the answer nonetheless.

您可以在Tomcat中的通过conf / server.xml中使用该类org.apache.catalina.valves.RemoteIpValve。

You can use the class org.apache.catalina.valves.RemoteIpValve in the conf/server.xml of tomcat.

    <Valve className="org.apache.catalina.valves.RemoteIpValve"
           remoteIpHeader="x-forwarded-for"
           remoteIpProxiesHeader="x-forwarded-by"
           protocolHeader="x-forwarded-proto"
    />

这篇关于处理的X转发-PROTO在java中的apache-tomcat的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆