Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
8289ea01
Unverified
Commit
8289ea01
authored
Aug 30, 2022
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Forbid .via backend stacking for now
suggested by Dridi
parent
9db64085
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
6 deletions
+43
-6
c00042.vtc
bin/varnishtest/tests/c00042.vtc
+20
-1
vcl-backend.rst
doc/sphinx/reference/vcl-backend.rst
+3
-2
vcc_backend.c
lib/libvcc/vcc_backend.c
+20
-3
No files found.
bin/varnishtest/tests/c00042.vtc
View file @
8289ea01
...
...
@@ -12,7 +12,7 @@ server s2 {
txresp -hdr "Server: s2"
} -start
# the use case for via-proxy is to have a(n ha)proxy make a
(n ssl
)
# the use case for via-proxy is to have a(n ha)proxy make a
(TLS
)
# connection on our behalf. For the purpose of testing, we use another
# varnish in place - but we are behaving realistically in that we do
# not use any prior information for the actual backend connection -
...
...
@@ -145,6 +145,7 @@ client c1 {
txreq -url /s1/5
rxresp
expect resp.status == 200
# vmod_proxy returns the empty string if the TLV is absent.
expect resp.http.Authority == ""
} -run
...
...
@@ -157,3 +158,21 @@ varnish v1 -errvcl "Cannot set both .via and .path" {
.path = "/path/to/uds";
}
}
varnish v1 -errvcl "Can not stack .via backends" {
backend a { .host = "${v2_addr}"; .port = "${v2_port}"; }
backend b {
.via = a;
.host = "127.0.0.1";
}
backend c {
.via = b;
.host = "127.0.0.2";
}
sub vcl_backend_fetch {
set bereq.backend = c;
}
}
doc/sphinx/reference/vcl-backend.rst
View file @
8289ea01
...
...
@@ -169,8 +169,9 @@ supported.
The ``.via`` attribute is unrelated to ``.proxy_header``. If both are
used, a second header is sent as per ``.proxy_header`` specification.
As of this release, the *proxy* backend used with ``.via`` can not be a
director and the protocol is fixed to `PROXY2`_.
As of this release, the *proxy* backend used with ``.via`` can not be
a director, it can not itself use ``.via`` (error: *Can not stack .via
backends*) and the protocol is fixed to `PROXY2`_.
Implementation detail:
...
...
lib/libvcc/vcc_backend.c
View file @
8289ea01
...
...
@@ -364,7 +364,8 @@ vcc_ParseProbe(struct vcc *tl)
*/
static
void
vcc_ParseHostDef
(
struct
vcc
*
tl
,
const
struct
token
*
t_be
,
const
char
*
vgcname
)
vcc_ParseHostDef
(
struct
vcc
*
tl
,
struct
symbol
*
sym
,
const
struct
token
*
t_be
,
const
char
*
vgcname
)
{
const
struct
token
*
t_field
;
const
struct
token
*
t_val
;
...
...
@@ -548,6 +549,19 @@ vcc_ParseHostDef(struct vcc *tl, const struct token *t_be, const char *vgcname)
ERRCHK
(
tl
);
AN
(
via
);
AN
(
via
->
rname
);
if
(
via
->
extra
!=
NULL
)
{
AZ
(
strcmp
(
via
->
extra
,
"via"
));
VSB_cat
(
tl
->
sb
,
"Can not stack .via backends at
\n
"
);
vcc_ErrWhere
(
tl
,
tl
->
t
);
VSB_destroy
(
&
tl
->
fb
);
return
;
}
AN
(
sym
);
AZ
(
sym
->
extra
);
sym
->
extra
=
"via"
;
SkipToken
(
tl
,
';'
);
}
else
if
(
vcc_IdIs
(
t_field
,
"authority"
))
{
ExpectErr
(
tl
,
CSTR
);
...
...
@@ -582,6 +596,9 @@ vcc_ParseHostDef(struct vcc *tl, const struct token *t_be, const char *vgcname)
return
;
}
if
(
via
!=
NULL
)
AZ
(
via
->
extra
);
vsb1
=
VSB_new_auto
();
AN
(
vsb1
);
VSB_printf
(
vsb1
,
...
...
@@ -666,7 +683,7 @@ void
vcc_ParseBackend
(
struct
vcc
*
tl
)
{
struct
token
*
t_first
,
*
t_be
;
struct
symbol
*
sym
;
struct
symbol
*
sym
=
NULL
;
const
char
*
dn
;
tl
->
ndirector
++
;
...
...
@@ -704,7 +721,7 @@ vcc_ParseBackend(struct vcc *tl)
}
}
Fh
(
tl
,
0
,
"
\n
static VCL_BACKEND %s;
\n
"
,
dn
);
vcc_ParseHostDef
(
tl
,
t_be
,
dn
);
vcc_ParseHostDef
(
tl
,
sym
,
t_be
,
dn
);
if
(
tl
->
err
)
{
VSB_printf
(
tl
->
sb
,
"
\n
In %.*s specification starting at:
\n
"
,
PF
(
t_first
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment