Expected ';' got 'req.url'

Paul A. Procacci pprocacci at datapipe.com
Wed Mar 28 18:40:41 CEST 2012


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.org
> 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.



More information about the varnish-misc mailing list