本文介绍了反向代理和getServerPort()背后的WebSphere Portal的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在访问部署在反向代理(使用Apache)后的WebSphere Portal时遇到问题.问题在于,在检查浏览器发出的HTTP请求时,某些请求针对代理,而某些则直接针对WebSphere Portal.

I have problems accessing WebSphere Portal which is deployed behind reverse proxy (using Apache). The problem is that while inspecting HTTP requests issued by browser, some requests are targeted at proxy, and some directly at WebSphere Portal.

我的Apache配置:

My Apache configuration:

ProxyPassReverseCookieDomain backend-server proxy-server

ProxyPass / http://backend-server:10039/
ProxyPassReverse / http://backend-server:10039/

问题是,一些生成的资源包含绝对URI,这些绝对URI的目标是backend-server:10039 ...

The problem is, some generated resources contained absolute URIs targeting at backend-server:10039...

我还应该配置什么以正确访问反向代理后面的WebSphere Portal?

What else should I configure to properly access WebSphere Portal behind reverse proxy?

推荐答案

因为我可以回答自己的问题,所以问题出在这里:

Because I can answer my own questions, here's what the problem was:

在服务器端,WebSphere Portal中的Portlet和JSP使用request.getServerHost()request.getServerPort().为了使这些方法在反向代理(发送Host:标头)后起作用.我必须添加:

At server-side, portlets and JSPs in WebSphere Portal use request.getServerHost() and request.getServerPort(). To make these methods work behind reverse proxy (which sends Host: header). I had to add:

ProxyPreserveHost On

要配置Apache,并且:

to apache configuration and:

com.ibm.ws.webcontainer.extractHostHeaderPort = true
trusthostheaderport = true

IBM控制台中Web容器的其他属性:WebSphere application servers -> WebSphere_Portal -> Web Container Settings -> Web Container -> Custom properties.

additional properties to Web Container in IBM Console: WebSphere application servers -> WebSphere_Portal -> Web Container Settings -> Web Container -> Custom properties.

这些属性在此处.

这篇关于反向代理和getServerPort()背后的WebSphere Portal的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-08 21:27