Re: USER_AGENT wrong thanks to proxy cache! Help!
| From: | Rasmus Lerdorf | Date: | Tue, 07 May 2002 21:38:38 +0000 |
| Subject: | Re: USER_AGENT wrong thanks to proxy cache! Help! | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-13611@lists.php.net to get a copy of this message | ||
You need to read up on content negotiation. Stopping your proxy from
cacheing any and all PHP stuff is a bit drastic. You simply need to tell
the proxy-cache that your content varies based on the user agent. You can
do this simply with:
Header('Vary: User-Agent');
You may want to read RFC 2616, especially section 14.44.
-Rasmus
On Tue, 7 May 2002, Roderick Martin wrote:
> I've got a script that calls the USER_AGENT variable and uses it to select a CCS
> file to load. Problem is, as I move from browser to browser, apparently the
> HTTP_USER gets stuck in the proxy cache and some browsers identify themselves as
> other browsers.
>
> Here's what I've found out.
>
> I have an .htm with several SSI's, one of which calls a .php. The .php runs fine
> - no problem.
>
> I upload the file to the server (Netscape Enterprise on NT) and load the page
> through the proxy (which reports the HTTP_USER) on IE for Mac. HTTP_USER is
> correct. I load the same page through the proxy on Mozilla for Mac. HTTP_USER is
> correct. I can switch back and forth between these as many times as I like and
> the info is correct.
>
> Now I switch to Windows and load on IE6 through proxy. HTTP_USER is correct.
> Netscape on Win? Correct. Now if I go back to the Mac and try IE again, it
> reports the HTTP_USER as IE6 on Windows NT.
>
> We have a couple Win boxes that don't go through the proxy, so I ran this same
> test again with a renamed file and then the HTTP_USER is correct.
>
> So... I apparently can jump between browsers on Macs with no ill side-effects.
> If I avoid the proxy on Windows I'm safe, but as soon as I hit a Windows browser
> through the proxy, the HTTP_USER is stuck on that browser identity when I return
> to the Mac side.
>
> Our server admin has blocked .php and .css files from being cached in the proxy,
> but it seems to have no effect. He personally wants to know if there is anything
> else he can block that might help.
>
> Me? I'm baffled, which isn't hard as I'm relatively new to PHP.
>
> The proxy server is a Compaq TaskSmart server (C1500) with the latest updates.
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>