Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > alt.apache.configuration > #4274
| From | "D. Stussy" <spam@spam.org> |
|---|---|
| Newsgroups | alt.apache.configuration |
| Subject | Re: Setting header based on %{REQUEST_URI} |
| Date | 2015-12-07 13:50 -0800 |
| Message-ID | <n44uum$hbr$1@snarked.org> (permalink) |
| References | <fdf035bc-bbf1-424c-b070-a251996fcba5@googlegroups.com> <9o506btucr26d4pb55rura7h7ddva7cauv@dim53.demon.nl> |
"Kees Nuyt" wrote in message
news:9o506btucr26d4pb55rura7h7ddva7cauv@dim53.demon.nl...
On Wed, 2 Dec 2015 17:43:16 -0800 (PST), ijunaidsubhani@gmail.com wrote:
> I am trying to Set a particular Header and its value based on a
> %{REQUEST_URI}.
>
> I am trying to set a header based on the URI of a particular page.
>
> 1. I access a page using chrome.
> 2. Inspect element and see that my URI header is giving the value
> /bst/index.html
> 3. Now in my Apache config , I want to set a Header to Yes if my
> %{REQUEST_URI}
> is equal to /bst/index.html
>
> This is what I am doing :
>
> RewriteCond %{REQUEST_URI} ^\/bst\/index\.html [NC]
> Header set X-Akamai Yes
>
> The above config is not working and is setting X-Akami for all the pages I
> am visiting on the web page.
>
> Any idea why ?
Warning: I'm not an expert ;) Anyway, I don't think rewrite does anything
useful here.
Maybe you should try:
SetEnvIf Request_URI ^\/bst\/index\.html XAKA=1
Header set X-Akamai Yes env=XAKA
==================================
Agreed that this will work, but it will do it pretty much universally for
all virtual hosts, and the backslash is unnecessary.
The problem with the OP's attempt is a misunderstanding on how the rewrite
engine works. RTFM. What was needed was this:
RewriteRule ^/bst/index\.html$ - [NC,E=XAKA:1]
Header set X-Akamai Yes env=XAKA
This is closer to what the OP asked.
Back to alt.apache.configuration | Previous | Next — Previous in thread | Find similar | Unroll thread
Setting header based on %{REQUEST_URI} ijunaidsubhani@gmail.com - 2015-12-02 17:43 -0800
Re: Setting header based on %{REQUEST_URI} Kees Nuyt <k.nuyt@nospam.demon.nl> - 2015-12-03 11:30 +0100
Re: Setting header based on %{REQUEST_URI} "D. Stussy" <spam@spam.org> - 2015-12-07 13:50 -0800
csiph-web