代码之家  ›  专栏  ›  技术社区  ›  kellerkindt

不带查询字符串的Apache2 ProxyPass

  •  0
  • kellerkindt  · 技术社区  · 2 年前

    我想向内部图生成器提供静态的URL,而不从客户端传递潜在的恶意查询参数。

    我有一个 VirtualHost 看起来有点像这样的配置

    <VirtualHost *:443>
    # ServerName, ServerAlias, SSLEngine, SSLCertificate...
    
        SSLProxyEngine on
        ProxyPass      /graph/great-graph1.png https://some.internal.host/the-graph.png?width=..&height=..&<more params>
        ProxyPass      /graph/great-graph2.png https://other.internal.host/the-graph.png?width=..&height=..&<more params>
    </VirtualHost>
    

    它几乎可以随心所欲地工作。图形是从正确的主机加载的,但有两件事不起作用:

    1. 配置的查询参数将被忽略
    2. 客户端提供的查询参数将传递给内部主机

    我试着添加 noquery 到的行的末尾 ProxyPass 其中提到了它的存在 here 但没有任何效果。

    我还尝试了各种 RewriteRule s(已启用 RewriteEngine )但我也无法找出正确的方法。

    0 回复  |  直到 2 年前