Forum Moderators: phranque

Message Too Old, No Replies

Reading and validating cookie in Apache

         

someone genius

7:06 am on Jul 24, 2009 (gmt 0)

10+ Year Member



I am new to Apache.
We have a requirement to read specific cookie value coming in browser request. If value doesn’t match with desired value then we need to show an html error page.

We are using Apache to cater all static content and Tomcat to project dynamic content. We don't have any dynamic code (php) running on Apache.

How to achieve this?

jdMorgan

12:05 pm on Jul 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Add a dynamic page (PHP, PERL, or SSI), or use mod_rewrite to check the cookie and rewrite or redirect the request as needed. See mod_rewrite RewriteCond with %{HTTP_COOKIE} variable. Apache 2.x can set and read cookies. Apache 1.3x can only read cookies. On Apache 1.3x you could use mod_headers to set cookies.

Jim