:Problem with cookies Rewriting rules

Martronic SA martronic at martronic.ch
Tue Aug 17 19:34:04 MSD 2010



*This part is working well:*

*****************************************


   upstream hoplanet {
     ip_hash;
     server 94.23.227.152:9190 max_fails=6 fail_timeout=60s;
     server 94.23.227.152:9191 max_fails=6 fail_timeout=60s;
     server 94.23.227.152:9192 max_fails=6 fail_timeout=60s;
     server 94.23.227.152:9193 max_fails=6 fail_timeout=60s;
   }

   server {
     listen 8201;
     server_namewww.hopla-net.com  hopla-net.com;
     access_log /home/awstats/hoplanet/access.log varnish;
     access_log /dev/null;

     if ($host ~* ^hopla-net\.com$) {
        rewrite ^(.*)http://www.hopla-net.com$1  permanent;
        break;
     }

        rewrite ^/bale(.*)http://bale.hopla-net.com$1;
        rewrite ^/alsace(.*)http://alsace.hopla-net.com$1;
        rewrite ^/bade-sud(.*)http://bade-sud.hopla-net.com$1;
        rewrite ^/jura(.*)http://jura.hopla-net.com$1;
        rewrite ^/bons-plans(.*)http://bons-plans.hopla-net.com$1;
        subs_filter_types text/html text/xml;
        subs_filter 'http://www.hopla-net.com/alsace''http://alsace.hopla-net.com';
        subs_filter 'http://www.hopla-net.com/bade-sud''http://bade-sud.hopla-net.com';
        subs_filter 'http://www.hopla-net.com/bale''http://bale.hopla-net.com';
        subs_filter 'http://www.hopla-net.com/jura''http://jura.hopla-net.com';
        subs_filter 'http://www.hopla-net.com/bons-plans''http://bons-plans.hopla-net.com';

     rewrite ^/(.*)/VirtualHostBase/http/www.hopla-net.com:80/hopla-net/VirtualHostRoot/$1 last;

     location / {
       proxy_passhttp://hoplanet;
     }
   }

   server {
     listen 8201;
     server_name bale.hopla-net.com;
     access_log /home/awstats/hoplanet/access.log varnish;
     access_log /dev/null;

     if ($host ~* ^hopla-net\.com$) {
        rewrite ^(.*)http://www.hopla-net.com$1  permanent;
        break;
     }

        rewrite ^/accueil(.*)http://www.hopla-net.com$1;
        rewrite ^/bale(.*)http://bale.hopla-net.com$1;
        rewrite ^/alsace(.*)http://alsace.hopla-net.com$1;
        rewrite ^/bade-sud(.*)http://bade-sud.hopla-net.com$1;
        rewrite ^/jura(.*)http://jura.hopla-net.com$1;
        rewrite ^/bons-plans(.*)http://bons-plans.hopla-net.com$1;

        subs_filter_types text/html text/xml;
        subs_filter 'id="portal-logo" href="http://bale.hopla-net.com"' 'id="portal-logo"
href="http://www.hopla-net.com"';
        subs_filter 'class="home" href="http://bale.hopla-net.com"' 'class="home"
href="http://www.hopla-net.com"';
        subs_filter 'http://bale.hopla-net.com/accueil''http://www.hopla-net.com/accueil';
        subs_filter 'http://bale.hopla-net.com/alsace''http://alsace.hopla-net.com';
        subs_filter 'http://bale.hopla-net.com/bade-sud''http://bade-sud.hopla-net.com';
        subs_filter 'http://bale.hopla-net.com/bale''http://bale.hopla-net.com';
        subs_filter 'http://bale.hopla-net.com/jura''http://jura.hopla-net.com';
        subs_filter 'http://bale.hopla-net.com/bons-plans''http://bons-plans.hopla-net.com';

     rewrite ^/(.*)
/VirtualHostBase/http/bale.hopla-net.com:80/hopla-net/bale/VirtualHostRoot/$1 last;

     location / {
       proxy_passhttp://hoplanet;
     }
   }

   server {
     listen 8201;
     server_name alsace.hopla-net.com;
     access_log /home/awstats/hoplanet/access.log varnish;
     access_log /dev/null;

     if ($host ~* ^hopla-net\.com$) {
        rewrite ^(.*)http://www.hopla-net.com$1  permanent;
        break;
     }

     rewrite ^/accueil(.*)http://www.hopla-net.com$1;
     rewrite ^/bale(.*)http://bale.hopla-net.com$1;
     rewrite ^/alsace(.*)http://alsace.hopla-net.com$1;
     rewrite ^/bade-sud(.*)http://bade-sud.hopla-net.com$1;
     rewrite ^/jura(.*)http://jura.hopla-net.com$1;
     rewrite ^/bons-plans(.*)http://bons-plans.hopla-net.com$1;

        subs_filter_types text/html text/xml;
        subs_filter 'id="portal-logo" href="http://alsace.hopla-net.com"' 'id="portal-logo"
href="http://www.hopla-net.com"';
        subs_filter 'class="home" href="http://alsace.hopla-net.com"' 'class="home"
href="http://www.hopla-net.com"';
        subs_filter 'http://alsace.hopla-net.com/accueil''http://www.hopla-net.com/accueil';
        subs_filter 'http://alsace.hopla-net.com/alsace''http://alsace.hopla-net.com';
        subs_filter 'http://alsace.hopla-net.com/bade-sud''http://bade-sud.hopla-net.com';
        subs_filter 'http://alsace.hopla-net.com/bale''http://bale.hopla-net.com';
        subs_filter 'http://alsace.hopla-net.com/jura''http://jura.hopla-net.com';
        subs_filter 'http://alsace.hopla-net.com/bons-plans''http://bons-plans.hopla-net.com';

     rewrite ^/(.*)
/VirtualHostBase/http/alsace.hopla-net.com:80/hopla-net/alsace/VirtualHostRoot/$1 last;

     location / {
       proxy_passhttp://hoplanet;
     }
   }

   server {
     listen 8201;
     server_name bade-sud.hopla-net.com;
     access_log /home/awstats/hoplanet/access.log varnish;
     access_log /dev/null;

     if ($host ~* ^hopla-net\.com$) {
        rewrite ^(.*)http://www.hopla-net.com$1  permanent;
        break;
     }

     rewrite ^/accueil(.*)http://www.hopla-net.com$1;
     rewrite ^/bale(.*)http://bale.hopla-net.com$1;
     rewrite ^/alsace(.*)http://alsace.hopla-net.com$1;
     rewrite ^/bade-sud(.*)http://bade-sud.hopla-net.com$1;
     rewrite ^/jura(.*)http://jura.hopla-net.com$1;
     rewrite ^/bons-plans(.*)http://bons-plans.hopla-net.com$1;

        subs_filter_types text/html text/xml;
        subs_filter 'id="portal-logo" href="http://bade-sud.hopla-net.com"' 'id="portal-logo"
href="http://www.hopla-net.com"';
        subs_filter 'class="home" href="http://bade-sud.hopla-net.com"' 'class="home"
href="http://www.hopla-net.com"';
        subs_filter 'http://bade-sud.hopla-net.com/accueil''http://www.hopla-net.com/accueil';
        subs_filter 'http://bade-sud.hopla-net.com/alsace''http://alsace.hopla-net.com';
        subs_filter 'http://bade-sud.hopla-net.com/bade-sud''http://bade-sud.hopla-net.com';
        subs_filter 'http://bade-sud.hopla-net.com/bale''http://bale.hopla-net.com';
        subs_filter 'http://bade-sud.hopla-net.com/jura''http://jura.hopla-net.com';
        subs_filter 'http://bade-sud.hopla-net.com/bons-plans''http://bons-plans.hopla-net.com';

     rewrite ^/(.*)
/VirtualHostBase/http/bade-sud.hopla-net.com:80/hopla-net/bade-sud/VirtualHostRoot/$1
last;

     location / {
       proxy_passhttp://hoplanet;
     }
   }


   server {
     listen 8201;
     server_name jura.hopla-net.com;
     access_log /home/awstats/hoplanet/access.log varnish;
     access_log /dev/null;

     if ($host ~* ^hopla-net\.com$) {
        rewrite ^(.*)http://www.hopla-net.com$1  permanent;
        break;
     }

     rewrite ^/accueil(.*)http://www.hopla-net.com$1;
     rewrite ^/bale(.*)http://bale.hopla-net.com$1;
     rewrite ^/alsace(.*)http://alsace.hopla-net.com$1;
     rewrite ^/bade-sud(.*)http://bade-sud.hopla-net.com$1;
     rewrite ^/jura(.*)http://jura.hopla-net.com$1;
     rewrite ^/bons-plans(.*)http://bons-plans.hopla-net.com$1;

        subs_filter_types text/html text/xml;
        subs_filter 'id="portal-logo" href="http://jura.hopla-net.com"' 'id="portal-logo"
href="http://www.hopla-net.com"';
        subs_filter 'class="home" href="http://jura.hopla-net.com"' 'class="home"
href="http://www.hopla-net.com"';
        subs_filter 'http://jura.hopla-net.com/accueil''http://www.hopla-net.com/accueil';
        subs_filter 'http://jura.hopla-net.com/alsace''http://alsace.hopla-net.com';
        subs_filter 'http://jura.hopla-net.com/bade-sud''http://bade-sud.hopla-net.com';
        subs_filter 'http://jura.hopla-net.com/bale''http://bale.hopla-net.com';
        subs_filter 'http://jura.hopla-net.com/jura''http://jura.hopla-net.com';
        subs_filter 'http://jura.hopla-net.com/bons-plans''http://bons-plans.hopla-net.com';

     rewrite ^/(.*)
/VirtualHostBase/http/jura.hopla-net.com:80/hopla-net/jura/VirtualHostRoot/$1 last;

     location / {
       proxy_passhttp://hoplanet;
     }
   }

   server {
     listen 8201;
     server_name bons-plans.hopla-net.com;
     access_log /home/awstats/hoplanet/access.log varnish;
     access_log /dev/null;

     if ($host ~* ^hopla-net\.com$) {
        rewrite ^(.*)http://www.hopla-net.com$1  permanent;
        break;
     }

     rewrite ^/accueil(.*)http://www.hopla-net.com$1;
     rewrite ^/bale(.*)http://bale.hopla-net.com$1;
     rewrite ^/alsace(.*)http://alsace.hopla-net.com$1;
     rewrite ^/bade-sud(.*)http://bade-sud.hopla-net.com$1;
     rewrite ^/jura(.*)http://jura.hopla-net.com$1;
     rewrite ^/bons-plans(.*)http://bons-plans.hopla-net.com$1;

        subs_filter_types text/html text/xml;
        subs_filter 'id="portal-logo" href="http://bons-plans.hopla-net.com"' 'id="portal-logo"
href="http://www.hopla-net.com"';
        subs_filter 'class="home" href="http://bons-plans.hopla-net.com"' 'class="home"
href="http://www.hopla-net.com"';
        subs_filter 'http://bons-plans.hopla-net.com/accueil''http://www.hopla-net.com/accueil';
        subs_filter 'http://bons-plans.hopla-net.com/alsace''http://alsace.hopla-net.com';
        subs_filter 'http://bons-plans.hopla-net.com/bade-sud''http://bade-sud.hopla-net.com';
        subs_filter 'http://bons-plans.hopla-net.com/bale''http://bale.hopla-net.com';
        subs_filter 'http://bons-plans.hopla-net.com/jura''http://jura.hopla-net.com';
        subs_filter 'http://bons-plans.hopla-net.com/bons-plans'
'http://bons-plans.hopla-net.com';

     rewrite ^/(.*)
/VirtualHostBase/http/bons-plans.hopla-net.com:80/hopla-net/bons-plans/VirtualHostRoot/$1
last;

     location / {
       proxy_passhttp://hoplanet;
     }
   }


*******************************************************************

*This part is not working.....*


*******************************************************************

   upstream hoplanet {
     ip_hash;
     server 94.23.227.152:9190 max_fails=6 fail_timeout=60s;
     server 94.23.227.152:9191 max_fails=6 fail_timeout=60s;
     server 94.23.227.152:9192 max_fails=6 fail_timeout=60s;
     server 94.23.227.152:9193 max_fails=6 fail_timeout=60s;
   }

   server {
     listen 8201;
     server_namewww.hopla-net.com  hopla-net.com;
     access_log /home/awstats/hoplanet/access.log varnish;


     if ($host ~* ^hopla-net\.com$) {
         rewrite ^(.*)http://www.hopla-net.com$1  permanent;
         break;
     }


     if ($http_kookie !~* "__ac") {
         rewrite ^/bale(.*)http://bale.hopla-net.com$1;
         rewrite ^/alsace(.*)http://alsace.hopla-net.com$1;
         rewrite ^/bade-sud(.*)http://bade-sud.hopla-net.com$1;
         rewrite ^/jura(.*)http://jura.hopla-net.com$1;
         rewrite ^/bons-plans(.*)http://bons-plans.hopla-net.com$1;
         rewrite ^(.*) $1/filter/;
     }


     location ~* ^(.*)/filter/$ {
         set $true_uri $1;
         subs_filter_types text/html text/xml;
         subs_filter 'http://www.hopla-net.com/alsace''http://alsace.hopla-net.com';
         subs_filter 'http://www.hopla-net.com/bade-sud''http://bade-sud.hopla-net.com';
         subs_filter 'http://www.hopla-net.com/bale''http://bale.hopla-net.com';
         subs_filter 'http://www.hopla-net.com/jura''http://jura.hopla-net.com';
         subs_filter 'http://www.hopla-net.com/bons-plans''http://bons-plans.hopla-net.com';
         proxy_pass
http://hoplanet/VirtualHostBase/http/www.hopla-net.com:80/hopla-net/VirtualHostRoot/$true_uri;
         break;
     }

     rewrite ^/(.*)/VirtualHostBase/http/www.hopla-net.com:80/hopla-net/VirtualHostRoot/$1 last;

     location / {
         proxy_passhttp://hoplanet;
     }

   }

   server {
     listen 8201;
     server_name bale.hopla-net.com;
     access_log /home/awstats/hoplanet/access.log varnish;

     if ($http_kookie !~* "__ac") {
         rewrite ^/accueil(.*)http://www.hopla-net.com$1;
         rewrite ^/alsace(.*)http://alsace.hopla-net.com$1;
         rewrite ^/bade-sud(.*)http://bade-sud.hopla-net.com$1;
         rewrite ^/jura(.*)http://jura.hopla-net.com$1;
         rewrite ^/bons-plans(.*)http://bons-plans.hopla-net.com$1;
         rewrite ^(.*) $1/filter/;
     }


     location ~* ^(.*)/filter/$ {
         set $true_uri $1;
         subs_filter_types text/html text/xml;
         subs_filter 'id="portal-logo" href="http://bale.hopla-net.com"' 'id="portal-logo"
href="http://www.hopla-net.com"';
         subs_filter 'class="home" href="http://bale.hopla-net.com"' 'class="home"
href="http://www.hopla-net.com"';
         subs_filter 'http://bale.hopla-net.com/accueil''http://www.hopla-net.com/accueil';
         subs_filter 'http://bale.hopla-net.com/alsace''http://alsace.hopla-net.com';
         subs_filter 'http://bale.hopla-net.com/bade-sud''http://bade-sud.hopla-net.com';
         subs_filter 'http://bale.hopla-net.com/jura''http://jura.hopla-net.com';
         subs_filter 'http://bale.hopla-net.com/bons-plans''http://bons-plans.hopla-net.com';
         proxy_pass
http://hoplanet/VirtualHostBase/http/bale.hopla-net.com:80/hopla-net/bale/VirtualHostRoot/$true_uri;
         break;
     }

     rewrite ^/(.*)
/VirtualHostBase/http/bale.hopla-net.com:80/hopla-net/bale/VirtualHostRoot/$1 last;

     location / {
         proxy_passhttp://hoplanet;
     }

   }

   server {
     listen 8201;
     server_name alsace.hopla-net.com;
     access_log /home/awstats/hoplanet/access.log varnish;

     if ($http_kookie !~* "__ac") {
         rewrite ^/accueil(.*)http://www.hopla-net.com$1;
         rewrite ^/bale(.*)http://bale.hopla-net.com$1;
         rewrite ^/bade-sud(.*)http://bade-sud.hopla-net.com$1;
         rewrite ^/jura(.*)http://jura.hopla-net.com$1;
         rewrite ^/bons-plans(.*)http://bons-plans.hopla-net.com$1;
         rewrite ^(.*) $1/filter/;
     }

     location ~* ^(.*)/filter/$ {
         set $true_uri $1;
         subs_filter_types text/html text/xml;
         subs_filter 'id="portal-logo" href="http://alsace.hopla-net.com"' 'id="portal-logo"
href="http://www.hopla-net.com"';
         subs_filter 'class="home" href="http://alsace.hopla-net.com"' 'class="home"
href="http://www.hopla-net.com"';
         subs_filter 'http://alsace.hopla-net.com/accueil''http://www.hopla-net.com/accueil';
         subs_filter 'http://alsace.hopla-net.com/bade-sud''http://bade-sud.hopla-net.com';
         subs_filter 'http://alsace.hopla-net.com/bale''http://bale.hopla-net.com';
         subs_filter 'http://alsace.hopla-net.com/jura''http://jura.hopla-net.com';
         subs_filter 'http://alsace.hopla-net.com/bons-plans''http://bons-plans.hopla-net.com';
         proxy_pass
http://hoplanet/VirtualHostBase/http/alsace.hopla-net.com:80/hopla-net/alsace/VirtualHostRoot/$true_uri;
         break;
     }

     rewrite ^/(.*)
/VirtualHostBase/http/alsace.hopla-net.com:80/hopla-net/alsace/VirtualHostRoot/$1 last;

     location / {
         proxy_passhttp://hoplanet;
     }

   }

   server {
     listen 8201;
     server_name bade-sud.hopla-net.com;
     access_log /home/awstats/hoplanet/access.log varnish;


     if ($http_kookie !~* "__ac") {
         rewrite ^/accueil(.*)http://www.hopla-net.com$1;
         rewrite ^/bale(.*)http://bale.hopla-net.com$1;
         rewrite ^/bade-sud(.*)http://bade-sud.hopla-net.com$1;
         rewrite ^/jura(.*)http://jura.hopla-net.com$1;
         rewrite ^/bons-plans(.*)http://bons-plans.hopla-net.com$1;
         rewrite ^(.*) $1/filter/;
     }

     location ~* ^(.*)/filter/$ {
         set $true_uri $1;
         subs_filter_types text/html text/xml;
         subs_filter 'id="portal-logo" href="http://bade-sud.hopla-net.com"' 'id="portal-logo"
href="http://www.hopla-net.com"';
         subs_filter 'class="home" href="http://bade-sud.hopla-net.com"' 'class="home"
href="http://www.hopla-net.com"';
         subs_filter 'http://bade-sud.hopla-net.com/accueil''http://www.hopla-net.com/accueil';
         subs_filter 'http://bade-sud.hopla-net.com/alsace''http://alsace.hopla-net.com';
         subs_filter 'http://bade-sud.hopla-net.com/bale''http://bale.hopla-net.com';
         subs_filter 'http://bade-sud.hopla-net.com/jura''http://jura.hopla-net.com';
         subs_filter 'http://bade-sud.hopla-net.com/bons-plans''http://bons-plans.hopla-net.com';
         proxy_pass
http://hoplanet/VirtualHostBase/http/bade-sud.hopla-net.com:80/hopla-net/bade-sud/VirtualHostRoot/$true_uri;
         break;
     }

     rewrite ^/(.*)
/VirtualHostBase/http/bade-sud.hopla-net.com:80/hopla-net/bade-sud/VirtualHostRoot/$1
last;

     location / {
         proxy_passhttp://hoplanet;
     }

   }


   server {
     listen 8201;
     server_name jura.hopla-net.com;
     access_log /home/awstats/hoplanet/access.log varnish;

     if ($http_kookie !~* "__ac") {
         rewrite ^/accueil(.*)http://www.hopla-net.com$1;
         rewrite ^/bale(.*)http://bale.hopla-net.com$1;
         rewrite ^/bade-sud(.*)http://bade-sud.hopla-net.com$1;
         rewrite ^/bons-plans(.*)http://bons-plans.hopla-net.com$1;
         rewrite ^(.*) $1/filter/;
     }

     location ~* ^(.*)/filter/$ {
         set $true_uri $1;
         subs_filter_types text/html text/xml;
         subs_filter 'id="portal-logo" href="http://jura.hopla-net.com"' 'id="portal-logo"
href="http://www.hopla-net.com"';
         subs_filter 'class="home" href="http://jura.hopla-net.com"' 'class="home"
href="http://www.hopla-net.com"';
         subs_filter 'http://jura.hopla-net.com/accueil''http://www.hopla-net.com/accueil';
         subs_filter 'http://jura.hopla-net.com/alsace''http://alsace.hopla-net.com';
         subs_filter 'http://jura.hopla-net.com/bade-sud''http://bade-sud.hopla-net.com';
         subs_filter 'http://jura.hopla-net.com/bale''http://bale.hopla-net.com';
         subs_filter 'http://jura.hopla-net.com/bons-plans''http://bons-plans.hopla-net.com';
         proxy_pass
http://hoplanet/VirtualHostBase/http/jura.hopla-net.com:80/hopla-net/jura/VirtualHostRoot/$true_uri;
         break;
     }

     rewrite ^/(.*)
/VirtualHostBase/http/jura.hopla-net.com:80/hopla-net/jura/VirtualHostRoot/$1 last;

     location / {
         proxy_passhttp://hoplanet;
     }

   }

   server {
     listen 8201;
     server_name bons-plans.hopla-net.com;
     access_log /home/awstats/hoplanet/access.log varnish;

     if ($http_kookie !~* "__ac") {
         rewrite ^/accueil(.*)http://www.hopla-net.com$1;
         rewrite ^/bale(.*)http://bale.hopla-net.com$1;
         rewrite ^/bade-sud(.*)http://bade-sud.hopla-net.com$1;
         rewrite ^/jura(.*)http://jura.hopla-net.com$1;
         rewrite ^(.*) $1/filter/;
     }

     location ~* ^(.*)/filter/$ {
         set $true_uri $1;
         subs_filter_types text/html text/xml;
         subs_filter 'id="portal-logo" href="http://bons-plans.hopla-net.com"'
'id="portal-logo" href="http://www.hopla-net.com"';
         subs_filter 'class="home" href="http://bons-plans.hopla-net.com"' 'class="home"
href="http://www.hopla-net.com"';
         subs_filter 'http://bons-plans.hopla-net.com/accueil''http://www.hopla-net.com/accueil';
         subs_filter 'http://bons-plans.hopla-net.com/alsace''http://alsace.hopla-net.com';
         subs_filter 'http://bons-plans.hopla-net.com/bade-sud''http://bade-sud.hopla-net.com';
         subs_filter 'http://bons-plans.hopla-net.com/bale''http://bale.hopla-net.com';
         subs_filter 'http://bons-plans.hopla-net.com/jura''http://jura.hopla-net.com';
         proxy_pass
http://hoplanet/VirtualHostBase/http/bons-plans.hopla-net.com:80/hopla-net/bons-plans/VirtualHostRoot/$true_uri;
         break;
     }

     rewrite ^/(.*)
/VirtualHostBase/http/bons-plans.hopla-net.com:80/hopla-net/bons-plans/VirtualHostRoot/$1
last;

     location / {
         proxy_passhttp://hoplanet;
     }

   }

**********************************************************************

Could help me with that? is there a better way to write this?
Thank you!

Martronic SA
Martial Moret




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20100817/a8aa6efe/attachment-0001.html>


More information about the nginx mailing list