You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Nguyen, Bao L" <ba...@intel.com> on 2012/10/26 17:57:30 UTC

[users@httpd] Rewritecond to check if a Cookie Exists

Hello,



When our users hit the url https://domain.mycompany.com/app I would like to write a rewrite rule to check for the existence of a SSO cookie called MYSAPSSO2.  Basically, if the MYSAPSSO2 cookie is not there then it should redirect users to a logon page to obtain the cookie.



I added the below into httpd.conf:



                RewriteEngine on

                RewriteCond %{REQUEST_URI} ^/app/?$

                RewriteCond %{HTTP_COOKIE} !MYSAPSSO2=true

                RewriteRule /app https://domain.mycompany.com/logon



However, Apache always do a  redirect does not matter if the MYSAPSSO2 exists or not.  It is probably because of my syntax in the " RewriteCond %{HTTP_COOKIE} !MYSAPSSO2=true" statement.  Could somebody please help with the syntax?



Thank you very much in advance!





Bao


Bao Nguyen
Intel Corp - SAP Integration Engineering
916-356-7153


RE: [users@httpd] Rewritecond to check if a Cookie Exists

Posted by "Nguyen, Bao L" <ba...@intel.com>.
Thanks Cicimov!

Bao Nguyen
Intel Corp - SAP Integration Engineering
916-356-7153

From: Igor Cicimov [mailto:icicimov@gmail.com]
Sent: Friday, October 26, 2012 2:53 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Rewritecond to check if a Cookie Exists


On 27/10/2012 3:08 AM, "Nguyen, Bao L" <ba...@intel.com>> wrote:
>
> Hello,
>
>
>
> When our users hit the url https://domain.mycompany.com/app I would like to write a rewrite rule to check for the existence of a SSO cookie called MYSAPSSO2.  Basically, if the MYSAPSSO2 cookie is not there then it should redirect users to a logon page to obtain the cookie.
>
>
>
> I added the below into httpd.conf:
>
>
>
>                 RewriteEngine on
>
>                 RewriteCond %{REQUEST_URI} ^/app/?$
>
>                 RewriteCond %{HTTP_COOKIE} !MYSAPSSO2=true

Whats true doing there??? This should be

RewriteCond %{HTTP_COOKIE} !^MYSAPSSO2$

>
>                 RewriteRule /app https://domain.mycompany.com/logon
>
>
>
> However, Apache always do a  redirect does not matter if the MYSAPSSO2 exists or not.  It is probably because of my syntax in the " RewriteCond %{HTTP_COOKIE} !MYSAPSSO2=true" statement.  Could somebody please help with the syntax?
>
>
>
> Thank you very much in advance!
>
>
>
>
>
> Bao
>
>
>
>
>
> Bao Nguyen
> Intel Corp - SAP Integration Engineering
> 916-356-7153
>
>

Re: [users@httpd] Rewritecond to check if a Cookie Exists

Posted by Igor Cicimov <ic...@gmail.com>.
On 27/10/2012 3:08 AM, "Nguyen, Bao L" <ba...@intel.com> wrote:
>
> Hello,
>
>
>
> When our users hit the url https://domain.mycompany.com/app I would like
to write a rewrite rule to check for the existence of a SSO cookie called
MYSAPSSO2.  Basically, if the MYSAPSSO2 cookie is not there then it should
redirect users to a logon page to obtain the cookie.
>
>
>
> I added the below into httpd.conf:
>
>
>
>                 RewriteEngine on
>
>                 RewriteCond %{REQUEST_URI} ^/app/?$
>
>                 RewriteCond %{HTTP_COOKIE} !MYSAPSSO2=true

Whats true doing there??? This should be

RewriteCond %{HTTP_COOKIE} !^MYSAPSSO2$

>
>                 RewriteRule /app https://domain.mycompany.com/logon
>
>
>
> However, Apache always do a  redirect does not matter if the MYSAPSSO2
exists or not.  It is probably because of my syntax in the " RewriteCond
%{HTTP_COOKIE} !MYSAPSSO2=true" statement.  Could somebody please help with
the syntax?
>
>
>
> Thank you very much in advance!
>
>
>
>
>
> Bao
>
>
>
>
>
> Bao Nguyen
> Intel Corp - SAP Integration Engineering
> 916-356-7153
>
>