<div dir="ltr">That should work. Possible problems may be that you rewrote req.url before testing it, or you are setting req.backend_hint (or bereq.backend) later in the vcl.<div><br></div><div>can you import std, and log the req.url right before the if-else, and log right before "<span style="font-size:12.8px">set req.backend_hint = esi;</span>"? It would also help if we had the client part of the log.</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div>-- <br></div>Guillaume Quintard<br></div></div></div>
<br><div class="gmail_quote">On Tue, Apr 26, 2016 at 1:54 PM, Andreas Loewen Internetservices <span dir="ltr"><<a href="mailto:kontakt@andreas-loewen.de" target="_blank">kontakt@andreas-loewen.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear all,<br>
<br>
i am using current varnish varnish 4. I have the following config:<br>
<br>
backend esi{<br>
.host = "x.x.x.x";<br>
.port = "8081";<br>
}<br>
<br>
...<br>
<br>
sub vcl_recv {<br>
set req.http.host = "<a href="http://xxx.yyy.de" rel="noreferrer" target="_blank">xxx.yyy.de</a>";<br>
...<br>
if (req.url ~ "^/typo3/.*" || req.url ~ "^/secure/.*") {<br>
set req.backend_hint = typo3be;<br>
return (synth(403, "Forbidden"));<br>
} else if (req.url ~ "\.mesi\?" || req.url ~ "\.htm(\?.*)?$" || req.url ~ "^/javax\.faces\..*" || req.url ~ "^/templates/.*" || req.url ~"^/f/.*" || req.url ~"^/i/.*") {<br>
set req.backend_hint = esi;<br>
set req.hash_always_miss = true;<br>
} else {<br>
set req.backend_hint = typo3;<br>
unset req.http.cookie;<br>
}<br>
<br>
...<br>
}<br>
<br>
sub vcl_backend_response {<br>
set beresp.do_esi = true;<br>
...<br>
<br>
}<br>
<br>
The esi backend is on a remote host, but it is reachable from this server.<br>
<br>
The funny thing is, that I keep getting 404's for my esi requests for /fe_terminliste.mesi?pakid=1 . But they are comming from the default backend (local Apache on port 81). varnishlog reads like:<br>
<br>
* << BeReq >> 5<br>
- Begin bereq 4 pass<br>
- Timestamp Start: 1461670355.552619 0.000000 0.000000<br>
- BereqMethod GET<br>
- BereqURL /fe_terminliste.mesi?pakid=1<br>
- BereqProtocol HTTP/1.1<br>
- BereqHeader Cache-Control: max-age=0<br>
- BereqHeader Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8<br>
- BereqHeader Upgrade-Insecure-Requests: 1<br>
- BereqHeader User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36<br>
- BereqHeader DNT: 1<br>
- BereqHeader Accept-Encoding: gzip, deflate<br>
- BereqHeader Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4<br>
- BereqHeader Cookie: PHPSESSID=h7hk5n8pa95q4sd2m46ebbju14; Typo3InstallTool=tgikum56sujjsv1cu6ra236kb0; be_typo_user=5ad26762d12ad4b9fe2d321979fb75e4<br>
- BereqHeader Host: xxx:8081<br>
- BereqHeader X-Forwarded-For: 80.171.39.71<br>
- BereqHeader X-Varnish: 5<br>
- VCL_call BACKEND_FETCH<br>
- VCL_return fetch<br>
- BackendOpen 20 default(127.0.0.1,,81) 127.0.0.1 33017<br>
- Backend 20 default default(127.0.0.1,,81)<br>
- Timestamp Bereq: 1461670355.552877 0.000257 0.000257<br>
- Timestamp Beresp: 1461670355.553530 0.000911 0.000654<br>
- BerespProtocol HTTP/1.1<br>
- BerespStatus 404<br>
- BerespReason Not Found<br>
- BerespHeader Date: Tue, 26 Apr 2016 11:32:35 GMT<br>
- BerespHeader Server: Apache/2.2.15 (CentOS)<br>
- BerespHeader Content-Length: 310<br>
- BerespHeader Connection: close<br>
- BerespHeader Content-Type: text/html; charset=iso-8859-1<br>
- TTL RFC 120 -1 -1 1461670356 1461670356 1461670355 0 0<br>
- VCL_call BACKEND_RESPONSE<br>
- TTL VCL 120 10 0 1461670356<br>
- VCL_return deliver<br>
- BerespHeader Content-Encoding: gzip<br>
- BerespUnset Content-Length: 310<br>
- Storage malloc Transient<br>
- ObjProtocol HTTP/1.1<br>
- ObjStatus 404<br>
- ObjReason Not Found<br>
- ObjHeader Date: Tue, 26 Apr 2016 11:32:35 GMT<br>
- ObjHeader Server: Apache/2.2.15 (CentOS)<br>
- ObjHeader Content-Type: text/html; charset=iso-8859-1<br>
- ObjHeader Content-Encoding: gzip<br>
- Fetch_Body 3 length -<br>
- Gzip G F E 310 268 80 2064 2074<br>
- Timestamp BerespBody: 1461670355.554030 0.001411 0.000500<br>
- BackendClose 20 default(127.0.0.1,,81)<br>
- Length 268<br>
- BereqAcct 623 0 623 180 310 490<br>
- End<br>
<br>
<br>
So, does varnish restrict esi to localhost for some reason? Or what is wrong?<br>
<br>
<br>
<br>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote></div><br></div>