logical or statement failing
Glenn Slaven
glenn at squixa.com
Sun Aug 16 10:19:05 CEST 2015
Hi Tim,
The problem is you need to escape the question mark in the regex like this:
"^\?oa_social_login_source=custom$"
The question maker is a regex special character meaning "match the previous
character one or zero times. That doesn't really work with the start of
line character.
You can see this compiling here
http://www.vclfiddle.net/150816-1e0353b/3
As a side note, the req.url will include the slash at the start if people
put in this url
http://beta.jokefire.com/?oa_social_login_source=custom
which would be entirely valid, could I suggest something like this:
"^/?\?oa_social_login_source=custom$"
Glenn
On 16 August 2015 at 14:01, Tim Dunphy <bluethundr at gmail.com> wrote:
>
> Hey guys,
>
> I'm trying to allow logins on my site. So I setup the following in my VCL
> under varnish 4:
>
> # Allow the beta site to login
> if ( req.http.host ~ "^beta\.jokefire\.com$" && req.url ~
> "^?oa_social_login_source=custom$" ) {
> return (pass);
> }
>
> But when I go to do a syntax check on the VCL I get the following error:
>
> #varnishd -C -f default.vcl
> Message from VCC-compiler:
> Regexp compilation error:
>
> nothing to repeat
>
> ('input' Line 111 Pos 62)
> if ( req.http.host ~ "^beta\.jokefire\.com$" && req.url ~
> "^?oa_social_login_source=custom$" ) {
>
> -------------------------------------------------------------##################################----
>
> Running VCC-compiler failed, exited with 2
>
> VCL compilation failed
>
>
> Could I get a little help with the syntax to get this working?
>
> Thanks,
> Tim
> --
> GPG me!!
>
> gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
--
*Glenn Slaven*
Principal Engineer
Ph: (02) 9119 0444
M: 0433 826 255
www.squixa.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20150816/b38e94fc/attachment.html>
More information about the varnish-misc
mailing list