简体   繁体   English

Apache2反向代理重定向

[英]Apache2 Reverse Proxy Redirection

I have configured an Apache reverse proxy, to connect to my Synology Nas, but it does not work. 我已经配置了一个Apache反向代理来连接到我的Synology Nas,但是它不起作用。 Not all queries are rewritten correctly to the new URL. 并非所有查询都正确地重写为新URL。

Here my Code: 这是我的代码:

<VirtualHost *:80>
ServerAdmin email@loclahost   
ServerName server.fritz.box

ProxyHTMLEnable On

ProxyPass        /external/  http://192.168.178.99:5000/ 
ProxyPassReverse  /external/ http://192.168.178.99:5000/ 


</VirtualHost>

Only the page name and the Logo appears in the browser, but not the Website. 浏览器中仅显示页面名称和徽标,而网站中不显示。

The Probelm is that the Proxy don't Rewrite the scripts: 该探查是代理不重写脚本:

<div id="sds-login-dialog-form" style="position: absolute; top: -10000px; left: -10000px;"><form id="login-form" class="x-plain-body" method="POST" action="login.cgi" target="login_iframe" onsubmit="return true;"><input type="text" id="login_username" name="username" maxlength="256" /><input type="password" id="login_passwd" name="passwd" maxlength="256" autocomplete="off" /><input type="text" id="login_otp" name="OTPcode" maxlength="8" autocomplete="off" /><input type="submit" id="login_submit" style="position: absolute; top: -10000px; left: -10000px;" tabindex="-1" /></form><iframe id="login_iframe" name="login_iframe" width="0" height="0" frameborder="0" style="display: none;"></iframe></div>
<div id="sds-apply-preview-form" style="position: absolute; top: -10000px; left: -10000px;"><form id="preview-form" class="x-plain-body" method="POST" action="modules/ControlPanel/modules/dsm.cgi" target="preview_iframe" onsubmit="return true;"><input type="submit" id="preview_submit" style="position: absolute; top: -10000px; left: -10000px;" tabindex="-1" /></form><iframe id="preview_iframe" name="preview_iframe" width="0" height="0" frameborder="0" style="display: none;"></iframe></div>
<script type="text/javascript" src="synodefs.cgi?v=1420615814"></script>
<script type="text/javascript" src="/scripts/uistrings.cgi?lang=ger&v=1427210921"></script>
<script type="text/javascript" src="/webfm/webUI/uistrings.cgi?lang=ger&v=1427210921"></script>
<script type="text/javascript" src="uistrings.cgi?lang=ger&v=1427210921"></script>
<script type="text/javascript" src="/scripts/prototype-1.6.1/prototype.js?v=1420615788"></script>
<script type="text/javascript" src="/scripts/ext-3/adapter/ext/ext-base.js?v=1420615788"></script>
<script type="text/javascript" src="/scripts/ext-3/ext-all.js?v=1420615788"></script>
<script type="text/javascript" src="/scripts/ext-3/ux/ux-all.js?v=1420615788"></script>
<script type="text/javascript" src="/scripts/scrollbar/flexcroll.js?v=1420615788"></script>
<script type="text/javascript" src="sds.js?v=1420615813"></script>

Only the Scrips with no / at the begin of the Link are callable. 只能调用链接开头没有/的脚本。

How can I Rewrite them to the new URL? 如何将它们重写为新的URL? I Hope you can help me! 我希望你能帮帮我!

Sorry for my bad english :) 对不起,我的英语不好 :)

Best Wishes Simon 最好的祝福西蒙

you might be able to use something like to only proxy the files with /script/ 您可能可以使用类似的方法,例如仅使用/ script /代理文件

ProxyPassMatch ^(/scripts/.*)$ http://192.168.178.99:5000/ ProxyPassMatch ^(/ scripts /.*)$ http://192.168.178.99:5000/

or if you want to proxy all that start with / although that might cause other issues 或者如果您想代理所有以/开头的内容,尽管这可能会导致其他问题

ProxyPassMatch ^(/.*)$ http://192.168.178.99:5000/ ProxyPassMatch ^(/.*)$ http://192.168.178.99:5000/

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

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