Problem with Substitutions NginxHttpSubsModule

I m’ having problems with Substitutions NginxHttpSubsModule,
Everything seems to be well installed, but it doesn’t substitute
anything in the html pages.

Here is my config file:


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 

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

 location / {
   subs_filter_types text/html text/xml;
   subs_filter chantent blabla;
   proxy_passhttp://hoplanet;
 }

}


I’ve desactivated Varnish and request directly to nginx, but ‘chantent’
in my pages are not substitued.

I wonder if substitution doesn’t work on proxied data???

Could you help me with that?

Thank you very much

Martronic SA
Martial Moret

Martronic SA at 2010-8-11 14:17 wrote:

server 94.23.227.152:9191 max_fails=6 fail_timeout=60s;
if ($host ~* ^hopla-net\.com$) {
  proxy_pass http://hoplanet;
}

}


I’ve desactivated Varnish and request directly to nginx, but ‘chantent’ in my pages are not substitued.

I wonder if substitution doesn’t work on proxied data???
Could you show me the debug.log? And what’s your Nginx’s version?
Thanks.
nginx mailing list
[email protected]
nginx Info Page


Weibin Y.

here is a part error.log but there was nothing particluar in it:


2010/08/10 18:07:16 [notice] 5917#0: *2003 “^hopla-net.com$” does not
match
www.hopla-net.com”, client: 212.74.132.20, server:www.hopla-net.com,
request: “GET
/bale/sitemap.xml HTTP/1.1”, host: “www.hopla-net.com:8201
2010/08/10 18:07:16 [notice] 5917#0: 2003 "^/(.)" matches
“/bale/sitemap.xml”, client:
212.74.132.20, server:www.hopla-net.com, request: “GET /bale/sitemap.xml
HTTP/1.1”, host:
www.hopla-net.com:8201
2010/08/10 18:07:16 [notice] 5917#0: *2003 rewritten data:
“/VirtualHostBase/http/www.hopla-net.com:80/hopla-net/VirtualHostRoot/bale/sitemap.xml”,
args:
“”, client: 212.74.132.20, server:www.hopla-net.com, request: “GET
/bale/sitemap.xml
HTTP/1.1”, host: “www.hopla-net.com:8201


This also:


2010/08/10 16:55:28 [emerg] 20796#0: bind() to 0.0.0.0:8201 failed (98:
Address already in use)
2010/08/10 16:55:28 [emerg] 20796#0: still could not bind()
2010/08/10 17:01:07 [error] 20907#0: *176 open()
“/usr/html/w00tw00t.at.ISC.SANS.DFind:)”
failed (2: No such file or directory), client: 127.0.0.1, server:
localhost, request: “GET
/w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1”, host: “127.0.0.1”
2010/08/10 17:05:57 [alert] 20903#0: worker process 20904 exited on
signal 9
2010/08/10 17:05:57 [alert] 20903#0: worker process 20907 exited on
signal 9
2010/08/10 17:20:38 [error] 24225#0: *1468 open()
“/usr/html/w00tw00t.at.ISC.SANS.DFind:)”
failed (2: No such file or directory), client: 127.0.0.1, server:
localhost, request: “GET
/w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1”, host: “127.0.0.1”
2010/08/10 17:21:28 [error] 24225#0: *1577 open()
“/usr/html/w00tw00t.at.ISC.SANS.DFind:)”
failed (2: No such file or directory), client: 127.0.0.1, server:
localhost, request: “GET
/w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1”, host: “127.0.0.1”
2010/08/10 17:24:20 [error] 28899#0: *137 open()
“/usr/html/w00tw00t.at.ISC.SANS.DFind:)”
failed (2: No such file or directory), client: 127.0.0.1, server:
localhost, request: “GET
/w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1”, host: “127.0.0.1”
2010/08/10 17:38:25 [error] 28898#0: *1146 open()
“/usr/html/w00tw00t.at.ISC.SANS.DFind:)”
failed (2: No such file or directory), client: 127.0.0.1, server:
localhost, request: “GET
/w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1”, host: “127.0.0.1”
2010/08/10 17:48:28 [error] 4386#0: *142 open()
“/usr/html/w00tw00t.at.ISC.SANS.DFind:)”
failed (2: No such file or directory), client: 127.0.0.1, server:
localhost, request: “GET
/w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1”, host: “127.0.0.1”


Here is the summary with our nginx version:


/usr/sbin/nginx -V
nginx version: nginx/0.7.67
built by gcc 4.3.2 (Debian 4.3.2-1.1)
TLS SNI support enabled
configure arguments: --prefix=/usr --conf-path=/etc/nginx/nginx.conf
–http-log-path=/var/log/nginx/access_log
–error-log-path=/var/log/nginx/error_log
–pid-path=/var/run/nginx.pid
–http-client-body-temp-path=/var/lib/nginx/body
–http-proxy-temp-path=/var/tmp/nginx/proxy
–http-fastcgi-temp-path=/var/tmp/nginx/fastcgi
–with-md5-asm --with-md5=/usr/include --with-sha1-asm
–with-sha1=/usr/include
–with-http_realip_module --with-http_ssl_module
–with-http_stub_status_module
–with-http_ssl_module --with-http_flv_module
–with-http_gzip_static_module
–add-module=/root/substitutions4nginx


Thank you!

Martronic SA
Martial Moret

Le 11.08.2010 08:41, Weibin Y. a écrit :

That’s it!!! I was zipping the content in the backend!
Thank you very much!

Another question:
Do you think it’s possible to “optimize” the html code using your
product and regular expressions?
Removing unnecessary backspaces and so on?

Thank you again!

Le 11.08.2010 09:26, Weibin Y. a écrit :

Martronic SA at 2010-8-11 14:54 wrote:

here is a part error.log but there was nothing particluar in it:
Hi,Martronic,
You should activate debug log when nginx compiled with --with-debug
configure argument.
Do you compress the pages in the backends? or content-encoding else?
Thanks.
212.74.132.20, server:www.hopla-net.com, request: "GET


localhost, request: "GET
2010/08/10 17:21:28 [error] 24225#0: *1577 open()
“/usr/html/w00tw00t.at.ISC.SANS.DFind:)”

–error-log-path=/var/log/nginx/error_log
–add-module=/root/substitutions4nginx

Martronic SA at 2010-8-11 14:17 wrote:

server 94.23.227.152:9191 max_fails=6 fail_timeout=60s;
if ($host ~* ^hopla-net\.com$) {
  subs_filter_types text/html text/xml;

I wonder if substitution doesn’t work on proxied data???

[email protected]
nginx Info Page


Weibin Y.

Ok, thank you very much for your help!

Martronic SA
Martial Moret

Le 11.08.2010 10:19, Weibin Y. a écrit :

I have a new question!

Is it possible to disable the subsitution rules (subs_filter) under a
particular condition (if)
I’ve tried to set those rules in a condition :

if ($http_cookie !~* “__ac”) {
subs_filter_types text/html;
subs_filter tt.site.domain aa.site.domain;
}

The error is that it’s not allowed to use this here.

Any idea or solution?

Thank you

Martronic SA
Martial Moret

Le 11.08.2010 10:19, Weibin Y. a écrit :

Martronic SA at 2010-8-11 23:45 wrote:

The error is that it’s not allowed to use this here.
No, this module is a filter module which can’t be controlled by the ‘if’
directive.
But you can use the ‘rewrite’ directive to redirect the request to
another location where you can use the substitutions module.

Any idea or solution?
Thank you

Martronic SA
Martial Moret


Weibin Y.

Martronic SA at 2010-8-11 16:04 wrote:

That’s it!!! I was zipping the content in the backend!
Thank you very much!

Another question:
Do you think it’s possible to “optimize” the html code using your
product and regular expressions?
Removing unnecessary backspaces and so on?
No, it’s the job you should do when you publish your pages. Maybe you
can set the gzip_filter module on. That’s fine.

My module is processing the content on the fly. It will consume a lot of
resource.

I will publish my module soon in the develop branch:
http://substitutions4nginx.googlecode.com/svn/branches/dev/. It’s very
steady now. I have do some refactor and optimizing works in this branch,
you should have try.

Thanks.

Thanks.

212.74.132.20, server:www.hopla-net.com, request: "GET


localhost, request: "GET
2010/08/10 17:21:28 [error] 24225#0: *1577 open()
“/usr/html/w00tw00t.at.ISC.SANS.DFind:)”

–error-log-path=/var/log/nginx/error_log
–add-module=/root/substitutions4nginx

Martronic SA at 2010-8-11 14:17 wrote:

server 94.23.227.152:9191 max_fails=6 fail_timeout=60s;
if ($host ~* ^hopla-net\.com$) {
  subs_filter_types text/html text/xml;

I wonder if substitution doesn’t work on proxied data???

[email protected]
nginx Info Page


nginx mailing list
[email protected]
nginx Info Page


Weibin Y.

Martronic SA at 2010-8-12 23:59 wrote:

server {
rewrite (.*)/fiter/$ http://bale.hopla-net.com$1;
subs_filter_types text/html text/xml;
subs_filter ‘http://www.hopla-net.com/bale’ ‘http://bale.hopla-net.com’;
proxy_pass http://hoplanet;
}
}

I don’t know if your configuration can work. But it is not necessary use
the external rewrite. What about like this:

server {

if ($hhtp_kookie !~* “__ac”) {
rewrite ^(.*) $1/filter/;
}

location = / {
proxy_pass http://hoplanet;
}

location ~* ^(.*)/filter/$ {
set $true_uri $1;
subs_filter_types text/html text/xml;
subs_filter ‘http://www.hopla-net.com/bale
http://bale.hopla-net.com’;
proxy_pass http://hoplanet$true_uri;
}
}

Le 11.08.2010 17:45, Martronic SA a écrit :

Martronic SA at 2010-8-11 16:04 wrote:
My module is processing the content on the fly. It will consume a


www.hopla-net.com:8201
This also:
2010/08/10 17:05:57 [alert] 20903#0: worker process 20904 exited
failed (2: No such file or directory), client: 127.0.0.1, server:
localhost, request: "GET

–http-client-body-temp-path=/var/lib/nginx/body


Everything seems to be well installed, but it doesn’t
server 94.23.227.152:9193 max_fails=6 fail_timeout=60s;
break;
proxy_pass http://hoplanet;
Thanks.



nginx mailing list
[email protected]
nginx Info Page


Weibin Y.

I’m still on the condition rule,
My code:


upstream hoplanet {
server xxx.xxx.xxx.xxx:8080;
server xxx.xxx.xxx.xxx:8081;
}

server {

if ($hhtp_kookie !~* “__ac”) {
rewrite ^/bale(.*) http://bale.hopla-net.com$1/filter/;
}

location = / {
proxy_passhttp://hoplanet;
}

location/filter/$ {
rewrite (.*)/fiter/$http://bale.hopla-net.com$1;
subs_filter_types text/html text/xml;
subs_filter
http://www.hopla-net.com/bale’‘http://bale.hopla-net.com’;
proxy_passhttp://hoplanet;
}
}


Is that the good way to do it? or is there another way to write that
conditional rule?

Thank you!

Martronic SA
Martial Moret

Le 11.08.2010 17:45, Martronic SA a écrit :

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