【问题标题】:Apache2 Reverse Proxy RedirectionApache2 反向代理重定向
【发布时间】:2015-05-28 00:49:49
【问题描述】:

我已配置 Apache 反向代理,以连接到我的 Synology Nas,但它不起作用。并非所有查询都正确重写为新 URL。

这是我的代码:

<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>

只有页面名称和徽标出现在浏览器中,而不是网站。

问题是代理不重写脚本:

<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>

只有链接开头没有 / 的 Scrips 是可调用的。

如何将它们重写为新的 URL? 我希望你能帮助我!

对不起我的英语不好:)

最好的祝愿 西蒙

【问题讨论】:

    标签: javascript apache rewrite reverse-proxy synology


    【解决方案1】:

    你也许可以使用类似的东西只用 /script/ 代理文件

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

    或者如果您想代理所有以 / 开头的内容,尽管这可能会导致其他问题

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

    【讨论】:

    • 是的,我想代理所有。但是我将使用 url mydomain.de/external 通过代理调用代理页面,它应该显示页面 192.168.178.99:5000,当我调用页面 mydomain.de/test 时,它应该显示页面 192.168.178.1:80。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-03
    • 2021-03-11
    • 1970-01-01
    • 2019-03-12
    • 2015-11-29
    • 1970-01-01
    相关资源
    最近更新 更多