<div dir="ltr">
<div>Dear all,</div><div></div><div>
<div>
<p>Currently, I migrate a configuration from Varnish 3 to Varnish 6 but I
have an issue concerning unset a header to a backend but keep it in the
resp.</p>
<p>Indeed, I cannot use it in vcl_backend_response because it's unset before (vcl_pass/vcl_backend_fetch)...</p>
<p>In the documentation (<a href="https://book.varnish-software.com/4.0/chapters/VCL_Subroutines.html" rel="nofollow noreferrer" target="_blank">https://book.varnish-software.com/4.0/chapters/VCL_Subroutines.html</a>),
I can see that "if you do not wish to send the X-Varnish header to the
backend server, you can remove it in vcl_miss or vcl_pass. For that
case, you can use unset bereq.http.x-varnish;." but I cannot use bereq
in vcl_miss/vcl_pass.</p>
<p>Do you have any idea how to keep this header in vcl_backend_response but without send it to backend?</p>
<p>In Varnish 3, I used it in vcl_miss/vcl_pass and the unset bereq was set in vcl_fetch.</p><p><u>Vcl code:</u><br></p>
<pre><code>vcl 4.1;
import std;
backend dev {
.host = "127.0.0.1";
.port = "8080";
}
sub vcl_recv {
set req.http.App="App1";
set req.backend_hint = dev;
return (hash);
}
sub vcl_miss {
unset req.http.App;
}
sub vcl_pass {
unset req.http.App;
}
sub vcl_backend_fetch {
unset bereq.http.App;
}
sub vcl_backend_response {
if (bereq.http.App) {
set beresp.http.Debug = "test";
set beresp.ttl = 10s;
set beresp.grace = 10s;
return (deliver); // not applied
}
}
sub vcl_deliver {
set res.http.App;
}<br><br></code></pre><pre><code></code></pre>
<u>Goal</u>:<br></div><div><ul><li>Currently: App header in unset for backend & client (unable to use it
in vcl_backend_response)</li><li>Goal: App header can be used for conditions in vcl_backend_response but not sent to the backend</li></ul><div>
Best regards,
</div></div></div>
</div>