How to append querystring parameters with Apache ProxyPass

Viewed 150

I am trying to use the GitLab API to access some files and I want to use them via Apache ProxyPass. I want to use the GitLab API via HTTP so I need to add a header named "private-token" for that. A raw call directly to the API would looks like:

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

As I want to use a ProxyPass, calls from clients would looks like:

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

Those calls must be translated to the previously shown request, appending the last part of the url "/raw?ref=master" where "ref" specifies the branch in GitLab

So far this is my Apache configuration and I am not really sure that I can append this new querystring parameter and the "/raw" to the proxypassed request. Note that this parameters are added in Apache and not comming from the client request.

<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]
0 Answers
Related