如何使用Apache ProxyPass追加querystring参数

问题描述

我正在尝试使用GitLab API访问某些文件,并且想通过Apache ProxyPass使用它们。我想通过HTTP使用GitLab API,因此需要为此添加一个名为“ private-token”的标头。直接对API的原始调用如下所示:

https://gitlab.sampleCompany.io/api/v4/projects/983/repository/files/README.md/raw?ref=master

由于我想使用ProxyPass,因此来自客户端的呼叫看起来像:

https://mySampleWebsite.com/sample-path/README.md

这些调用必须转换为先前显示的请求,并在URL的最后部分附加“ / raw?ref = master”,其中“ ref”指定GitLab中的分支

到目前为止,这是我的Apache配置,我不确定是否可以将此新的querystring参数和“ / raw”附加到proxypassed请求中。请注意,此参数是在Apache中添加的,并非来自客户端请求。

<Location "/sample-path/">
   ProxyPass           "https://gitlab.sampleCompany.io/api/v4/projects/983/repository/files/" interpolate Keepalive=On retry=0 disablereuse=on
   ProxyPassReverse    "https://gitlab.sampleCompany.io/api/v4/projects/983/repository/files/" interpolate
   RequestHeader set private-token "my-token-value"
</Location>

RewriteCond %{REQUEST_URI} ^/sample-path/ [OR]
RewriteRule ^ - [L]

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)