Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Varnish: Misc

Expected ';' got 'req.url'

 

 

Varnish misc RSS feed   Index | Next | Previous | View Threaded


longvnit at gmail

Mar 28, 2012, 9:15 AM

Post #1 of 3 (383 views)
Permalink
Expected ';' got 'req.url'

I used the vcl code to redirect website to mobile version as follow

sub vcl_recv {
if ((req.http.User-Agent ~ "iP(hone|od)" || req.http.User-Agent ~
"Android" || req.http.User-Agent ~ "Symbian" || req.http.User-Agent ~
"^BlackBerry" || req.http.User-Agent ~ "^SonyEricsson" ||
req.http.User-Agent ~ "^Nokia" || req.http.User-Agent ~ "^SAMSUNG" ||
req.http.User-Agent ~ "^LG" || req.http.User-Agent ~ "webOS" ||
req.http.User-Agent ~ "^PalmSource") && req.http.host ~ "^(www.vechai.info|
vechai.info)") {
error 750 "Moved Temporarily";
}
}

sub vcl_error {
if (obj.status == 750) {
set obj.http.Location = "http://domain.com" req.url;
set obj.status = 302;
return(deliver);
}
}

But when I use above code on Centos has kernel version is Linux
localhost.localdomain 2.6.32-71.el6.x86_64 #1 SMP Fri May 20 03:51:51 BST
2011 x86_64 x86_64 x86_64 GNU/Linux then every things is ok.
But when I use bove code on Centos has kernel version is Linux
server6.vina84.com 2.6.18-308.1.1.el5 #1 SMP Wed Mar 7 04:16:51 EST 2012
x86_64 x86_64 x86_64 GNU/Linux then fail :(
Both OS updated latest version.

Error as follow:
Message from VCC-compiler:
Expected ';' got 'req.url'
(program line 174), at
('input' Line 121 Pos 64)
set obj.http.Location = "http://domain.com" req.url;
---------------------------------------------------------------#######-

Running VCC-compiler failed, exit 1
VCL compilation failed
Command failed with error code 106

And when I change "set obj.http.Location = "http://domain.com" req.url;"
to " set obj.http.Location = "http://domain.com";" then varnish is aleady
running.


pprocacci at datapipe

Mar 28, 2012, 9:40 AM

Post #2 of 3 (377 views)
Permalink
Re: Expected ';' got 'req.url' [In reply to]

I think to concat strings you need a '+' sign between them.
You should also escape your '.' periods in your regex's.

~Paul

On Wed, Mar 28, 2012 at 11:15:58PM +0700, Nguyen Long wrote:
> I used the vcl code to redirect website to mobile version as follow
>
> sub vcl_recv {
> if ((req.http.User-Agent ~ "iP(hone|od)" || req.http.User-Agent ~
> "Android" || req.http.User-Agent ~ "Symbian" || req.http.User-Agent ~
> "^BlackBerry" || req.http.User-Agent ~ "^SonyEricsson" ||
> req.http.User-Agent ~ "^Nokia" || req.http.User-Agent ~ "^SAMSUNG" ||
> req.http.User-Agent ~ "^LG" || req.http.User-Agent ~ "webOS" ||
> req.http.User-Agent ~ "^PalmSource") && req.http.host ~ "^(www.vechai.info|
> vechai.info)") {
> error 750 "Moved Temporarily";
> }
> }
>
> sub vcl_error {
> if (obj.status == 750) {
> set obj.http.Location = "http://domain.com" req.url;
> set obj.status = 302;
> return(deliver);
> }
> }
>
> But when I use above code on Centos has kernel version is Linux
> localhost.localdomain 2.6.32-71.el6.x86_64 #1 SMP Fri May 20 03:51:51 BST
> 2011 x86_64 x86_64 x86_64 GNU/Linux then every things is ok.
> But when I use bove code on Centos has kernel version is Linux
> server6.vina84.com 2.6.18-308.1.1.el5 #1 SMP Wed Mar 7 04:16:51 EST 2012
> x86_64 x86_64 x86_64 GNU/Linux then fail :(
> Both OS updated latest version.
>
> Error as follow:
> Message from VCC-compiler:
> Expected ';' got 'req.url'
> (program line 174), at
> ('input' Line 121 Pos 64)
> set obj.http.Location = "http://domain.com" req.url;
> ---------------------------------------------------------------#######-
>
> Running VCC-compiler failed, exit 1
> VCL compilation failed
> Command failed with error code 106
>
> And when I change "set obj.http.Location = "http://domain.com" req.url;"
> to " set obj.http.Location = "http://domain.com";" then varnish is aleady
> running.

> _______________________________________________
> varnish-misc mailing list
> varnish-misc [at] varnish-cache
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

________________________________

This message may contain confidential or privileged information. If you are not the intended recipient, please advise us immediately and delete this message. See http://www.datapipe.com/legal/email_disclaimer/ for further information on confidentiality and the risks of non-secure electronic communication. If you cannot access these links, please notify us by reply message and we will send the contents to you.

_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


zacharyalexstern at gmail

Mar 28, 2012, 11:08 AM

Post #3 of 3 (364 views)
Permalink
Re: Expected ';' got 'req.url' [In reply to]

Varnish 3 does in fact a string concatenation character, "+", as per:
https://www.varnish-cache.org/docs/3.0/installation/upgrade.html
*
*
*-Zachary*

On Wed, Mar 28, 2012 at 12:40 PM, Paul A. Procacci
<pprocacci [at] datapipe>wrote:

> I think to concat strings you need a '+' sign between them.
> You should also escape your '.' periods in your regex's.
>
> ~Paul
>
> On Wed, Mar 28, 2012 at 11:15:58PM +0700, Nguyen Long wrote:
> > I used the vcl code to redirect website to mobile version as follow
> >
> > sub vcl_recv {
> > if ((req.http.User-Agent ~ "iP(hone|od)" || req.http.User-Agent ~
> > "Android" || req.http.User-Agent ~ "Symbian" || req.http.User-Agent ~
> > "^BlackBerry" || req.http.User-Agent ~ "^SonyEricsson" ||
> > req.http.User-Agent ~ "^Nokia" || req.http.User-Agent ~ "^SAMSUNG" ||
> > req.http.User-Agent ~ "^LG" || req.http.User-Agent ~ "webOS" ||
> > req.http.User-Agent ~ "^PalmSource") && req.http.host ~ "^(
> www.vechai.info|
> > vechai.info)") {
> > error 750 "Moved Temporarily";
> > }
> > }
> >
> > sub vcl_error {
> > if (obj.status == 750) {
> > set obj.http.Location = "http://domain.com" req.url;
> > set obj.status = 302;
> > return(deliver);
> > }
> > }
> >
> > But when I use above code on Centos has kernel version is Linux
> > localhost.localdomain 2.6.32-71.el6.x86_64 #1 SMP Fri May 20 03:51:51 BST
> > 2011 x86_64 x86_64 x86_64 GNU/Linux then every things is ok.
> > But when I use bove code on Centos has kernel version is Linux
> > server6.vina84.com 2.6.18-308.1.1.el5 #1 SMP Wed Mar 7 04:16:51 EST 2012
> > x86_64 x86_64 x86_64 GNU/Linux then fail :(
> > Both OS updated latest version.
> >
> > Error as follow:
> > Message from VCC-compiler:
> > Expected ';' got 'req.url'
> > (program line 174), at
> > ('input' Line 121 Pos 64)
> > set obj.http.Location = "http://domain.com" req.url;
> > ---------------------------------------------------------------#######-
> >
> > Running VCC-compiler failed, exit 1
> > VCL compilation failed
> > Command failed with error code 106
> >
> > And when I change "set obj.http.Location = "http://domain.com"
> req.url;"
> > to " set obj.http.Location = "http://domain.com";" then varnish is
> aleady
> > running.
>
> > _______________________________________________
> > varnish-misc mailing list
> > varnish-misc [at] varnish-cache
> > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
> ________________________________
>
> This message may contain confidential or privileged information. If you
> are not the intended recipient, please advise us immediately and delete
> this message. See http://www.datapipe.com/legal/email_disclaimer/ for
> further information on confidentiality and the risks of non-secure
> electronic communication. If you cannot access these links, please notify
> us by reply message and we will send the contents to you.
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc [at] varnish-cache
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>

Varnish misc RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.