Preventing dup backend names with dynamic backends in VMODs
Geoff Simmons
geoff at uplex.de
Sun Nov 1 18:06:18 CET 2015
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
On 10/30/2015 05:19 PM, Kacper Wysocki wrote:
>
> slightly related to this, could we possibly allow accessing the
> name in VCL, like
>
> if(req.backend_hint ~ "zool") { /* do something */ }
If you can wait until vcl_backend_response(), you do have
beresp.backend.name as a string, and this will work:
if (beresp.backend.name ~ "zool") {
/* do something */
}
> or even
>
> std.log("backend was " + req.backend_hint); ?
That works, try it. Evidently because a STRING_LIST is required in
std.log(), and VCC knows to do implicit string conversions for the
various data types -- it even works without the concatenation.
A regex match against req.backend_hint or bereq.backend doesn't work
because a STRING is required. IIUC, VCC does implicit string
conversions where a STRING_LIST is expected, but not where a STRING is
expected.
Best,
Geoff
- --
** * * UPLEX - Nils Goroll Systemoptimierung
Scheffelstraße 32
22301 Hamburg
Tel +49 40 2880 5731
Mob +49 176 636 90917
Fax +49 40 42949753
http://uplex.de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBCAAGBQJWNkaKAAoJEOUwvh9pJNURxzEP/AuAvXWe0mOYh7XhGfPN25dU
6/EcBRCLbRhG+SXiBiv2rKl8iyU8O8zlH/tLbBsXalg+KMUIgB+qks7Qvk7XU8Y1
2/N4xDW9mwm3e9I1nYuBs2wEbTUmkfXgi4D1TXYHL6PUGZ64oj+px3sntDKHV5Xu
jNIpMW3S4/O91csoO/2ittab8H6S5ue3R690ncVMaJCiIm3zyfwNO73Yy7fsivcn
m8IXFI7aW1ER0gO9fFso9zthYjoqhsDGZ9BcUQ1RK7uq9YKrUAEexxPHHNaizLk3
vv37m8dgYMu8YSjX8mB4r2sag+SCuwkmSrxvSsuVG5vS/YvsVm6rupSPl3sHP8ix
Xu48LEPVNGTySDRVY+oeo0Eqi3R71FUqoe1UFpMGsgxEXUFgRPSpwZG8dl4pa+wc
jdOLheP9NkKzUDSd8npidrcn7jEysHXFD9OeiNoUwQpjDhSGtagV/wyU+A/xs8y3
SQuATofqjv4+PhblF90dvEepVZzJBLqrQ4BMRx9hHzHwwtHZOFQhUIMxr2tPAmYa
pxq1SpfjS+RuJzsw3Gi5DkyU0XOKcZ1QZg01bNZWdKesijy7mXcHrrzRQq/HQ9Ee
KM+Y8ZrF+InSne/YtmCVJFpXG+CncfRkFRSgoYnPZSzpIaVJ1w11cJkP41rlEFE2
BzbJJwNrpDuv2BikqW7y
=F6by
-----END PGP SIGNATURE-----
More information about the varnish-dev
mailing list