【问题标题】:How can I block apache2 root path to a proxy? is it even possible?如何阻止 apache2 代理的根路径?有可能吗?
【发布时间】:2022-01-24 10:36:53
【问题描述】:

所以我正在托管一个 icecast 服务器,我想使用 apache2 将 ssl 终止代理到 icecast。 我使用 nginx 代理进行 icecast,这是完美的,但 nginx 和 php 有一些复杂性,所以我必须使用 apache2。

所以我试图实现与我在 nginx 中实现的代理相同的代理,但我根本无法阻止根路径而不阻止所有内容,或者它根本不起作用。

下面是我的虚拟主机,我添加了一些 cmets 进行一些尝试(大约 100 次尝试中的 2 次,哈哈)

<VirtualHost *:8050>
        ServerAlias     *.mydomain.com

        SSLEngine on
        SSLCertificateFile      /etc/apache2/ssl/mydomain.com.pem

        ProxyPreserveHost On

        RewriteEngine On
        RewriteCond %{REQUEST_URI} ^/stats.xsl [NC]
        RewriteCond %{REQUEST_URI} ^/index.html [NC]
        # this doesnt work. I expect because of the Rewrite Rule below?
        #RewriteCond %{REQUEST_URI} ^/ [NC]
        RewriteRule .* - [F,L]

        # this doesnt work it blocks everything
        #<Location />
        #        Order Allow,Deny
        #        Deny from  all
        #</Location>

        ErrorLog ${APACHE_LOG_DIR}/mediaserverproxy-error.log
        CustomLog ${APACHE_LOG_DIR}/mediaserverproxy-access.log combined

        ProxyPass / http://localhost:80/
        ProxyPassReverse / http://localhost:80/

</VirtualHost>

需要明确的是,我知道您可以在 icecast 中执行 ssl,但它会在发送 icecast HUP 信号以进行重新加载时降低稳定性。

非常感谢任何帮助

【问题讨论】:

    标签: proxy apache2 block root icecast


    【解决方案1】:

    预期的结果是什么? 对 / 的请求将返回 404,而任何其他请求将使用 200 为该路径提供服务?

    【讨论】:

    • 预期的结果应该是 403 但 404 仍然可以,只要我阻止请求在 / 到达 icecast 服务器,那么我已经成功 Icecast 在 / 设置了蜜罐,所以它禁止整个代理(如果需要)。
    猜你喜欢
    • 1970-01-01
    • 2012-05-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-04
    • 2015-09-06
    • 2020-10-21
    相关资源
    最近更新 更多