简体   繁体   中英

How to set url parameter in header

I have a client request that cannot contains custom headers, but server-side I need a hearder (let's call him foo).

So I have this url path/to/bar?foo=value

I want that my apache conf that the foo value and put it in a header. I haven't so far find a solution :(.

Finaly I find a solution

RewriteEngine On
RewriteCond %{QUERY_STRING} ^(?:.*&)?foo=(.*)$
RewriteRule ^ - [env=foo:%1]
<IfDefine !foo>
    RequestHeader set Foo %{foo}e env=foo
</IfDefine>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM