我们的团队是Apache的新手。 我们有一个SharePoint 2007应用程序,位于我们的内部服务器上,地址是http://internal.site.com 。
我们需要使用Apache作为从外部站点到内部服务器的反向代理。 外部服务器是在一个地址,我们将调用http://external.site.com/appname 。
这个问题伴随着SharePoint的相关链接。 链接在sharepoint页面可能会指向“/_layouts/dir/subdir/page.aspx”,但是当传递到代理,这个链接在页面中显示为http://external.site.com/_layouts/ … (没有/ appname附加上)。 所以看来我们必须做一个URL重写。
但是这会扩展到其他问题 – SharePoint生成的样式表,JavaScript等中的相对URL(即我们无法控制)。
SharePoint还会创build一些url“\ u002flayouts \ u002fuserdisp.aspx?Force = True \ u0026ID =”
到目前为止,我认为解决这个问题的最好方法是,对于每个URL(包括样式表,javascript等):
这可能是对的,也可能是错误的,我欢迎你的意见,如何做得更好。
为了实现这个目标,到目前为止,我已经有一个configuration文件,我确定在很多方面都是错误的,但我认为是一个开始。 我想就如何更好地实施我的想法提出意见。
ProxyRequests off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass /appname/ http://internal.site.com/ ProxyPassReverse /appname/ http://internal.site.com/ <Location /appname/> ProxyHTMLEnable On ProxyHTMLExtended On ProxyHTMLLogVerbose On #List of HTML elements to change ProxyHTMLLinks a href ProxyHTMLLinks area href ProxyHTMLLinks link href ProxyHTMLLinks img src longdesc usemap ProxyHTMLLinks object classid codebase data usemap ProxyHTMLLinks q cite ProxyHTMLLinks blockquote cite ProxyHTMLLinks ins cite ProxyHTMLLinks del cite ProxyHTMLLinks form action ProxyHTMLLinks input src usemap ProxyHTMLLinks head profile ProxyHTMLLinks base href ProxyHTMLLinks script src for # To support scripting events (with ProxyHTMLExtended On), # you'll need to declare them too. ProxyHTMLEvents onclick ondblclick onmousedown onmouseup \ onmouseover onmousemove onmouseout onkeypress \ onkeydown onkeyup onfocus onblur onload \ onunload onsubmit onreset onselect onchange #Goal: Map any URL that starts with a / (ie a relative link) to http://internal.site.com/ ProxyHTMLURLMap ^/ http://internal.site.com/ </Location>
提前感谢您的帮助,您可以给!
一切顺利,肖恩
您面临的困难是常见的:您想使用不同于应用程序期望的URIpath访问Web应用程序。 标准的Apache代理机制只处理标题中的链接(例如, Location:标题),而不是在文档的内容中,所以使用绝对path(如/images/foo.png链接不再到达正确的位置(相对path通常应该工作得很好)。
一个常见的解决scheme是使用mod_proxy_html模块,它将允许您在网页内容中执行replace。 实际上, 本教程涵盖了您所描述的情况。
为什么不使用子域而不是文件夹呢:
https://efg.site.com而不是https://www.site.com/efg 。 如果必须从该文件夹开始,您可以始终设置redirect。 这应该避免相对的链接问题。