<div dir="auto">Okie let me check. No idea what's going wrong. Trying with different backend servers and all are getting 502.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 19, 2019, 6:48 PM Guillaume Quintard <<a href="mailto:guillaume@varnish-software.com">guillaume@varnish-software.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">varnish doesn't generate 502s, that's your backend misbehaving. Again, look at what you are sending to it using varnishlog, and understand what is happening, but at this time, this is not a varnish issue.<br clear="all"><div><div dir="ltr" data-smartmail="gmail_signature"><div dir="ltr"><div>-- <br></div>Guillaume Quintard<br></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 19, 2019 at 1:59 PM Varun Nath <<a href="mailto:varunnath86@gmail.com" target="_blank" rel="noreferrer">varunnath86@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">I am getting 502 Operation not permitted error. The log is as below:<div><br></div><div>ObjStatus 502<br>ObjReason Operation not permitted<br></div><div><br></div><div>Sorry for the inconvenience 🙏</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 19, 2019 at 6:15 PM Guillaume Quintard <<a href="mailto:guillaume@varnish-software.com" target="_blank" rel="noreferrer">guillaume@varnish-software.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">you need to understand what is going on why the backend is replying with 403, then we can fix the vcl.<div><br clear="all"><div><div dir="ltr"><div dir="ltr"><div>-- <br></div>Guillaume Quintard<br></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 19, 2019 at 1:18 PM Varun Nath <<a href="mailto:varunnath86@gmail.com" target="_blank" rel="noreferrer">varunnath86@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thank You. Could you please confirm whether the VCL config I have shared if fine?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 19, 2019 at 5:46 PM Guillaume Quintard <<a href="mailto:guillaume@varnish-software.com" target="_blank" rel="noreferrer">guillaume@varnish-software.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>check the backend transaction, and understand why your origin is sending back a 403. This is due to your backend configuration and I can't help you with that.</div><div><br clear="all"><div><div dir="ltr"><div dir="ltr"><div>-- <br></div>Guillaume Quintard<br></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 19, 2019 at 1:03 PM Varun Nath <<a href="mailto:varunnath86@gmail.com" target="_blank" rel="noreferrer">varunnath86@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">This is the VCL file am using:<div><br></div><div>Note: Host is not a valid one</div><div><br></div><div>vcl 4.0;<br>import std;<br>import directors;<br><br># Default backend definition. Set this to point to your content server.<br>backend default {<br> .host = "<a href="http://remote.host.com" target="_blank" rel="noreferrer">remote.host.com</a>";<br> .port = "80";<br>}<br><br>sub vcl_init {<br> new vdir = directors.round_robin();<br> vdir.add_backend(default);<br>}<br><br>sub vcl_recv {<br> unset req.http.proxy;<br> unset req.http.cookie;<br> set req.http.x-host = "<a href="http://remote.host.com" target="_blank" rel="noreferrer">http://remote.host.com</a>";<br> set req.http.x-clientip = client.ip;<br> set req.http.x-serverip = server.ip;<br> set req.http.x-localip = local.ip;<br> set req.http.x-remoteip = remote.ip;<br> unset req.http.X-Forwarded-For;<br> set req.http.x-forwarded-for = client.ip;<br> return(pass);<br>}<br><br>sub vcl_backend_response {<br> # Happens after we have read the response headers from the backend.<br> #<br> # Here you clean the response headers, removing silly Set-Cookie headers<br> # and other mistakes your backend does.<br>}<br><br>sub vcl_deliver {<br> # Happens when we have all the pieces we need, and are about to send the<br> # response to the client. <br>}<br></div><div><br></div><div>Please let me know if I need to add something more to make the remote host caching from localhost varnish</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 19, 2019 at 5:05 PM Varun Nath <<a href="mailto:varunnath86@gmail.com" target="_blank" rel="noreferrer">varunnath86@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hello, <div>I got some response via CURL. But getting 403 Forbidden message. Log is as below:</div><div><i><b> BerespStatus 403</b></i></div><i><b> BerespReason Forbidden</b></i></div><div>Also tried setting</div><div><b><i>remove req.http.X-Forwarded-For;<br>set req.http.x-forwarded-for = client.ip;</i></b><br></div><div>But didnt work.</div><div>Could you please share your thoughts?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 19, 2019 at 3:00 PM Varun Nath <<a href="mailto:varunnath86@gmail.com" target="_blank" rel="noreferrer">varunnath86@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thank You so much for your support. Will try this and let you know</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 19, 2019 at 2:49 PM Guillaume Quintard <<a href="mailto:guillaume@varnish-software.com" target="_blank" rel="noreferrer">guillaume@varnish-software.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">The backend portion of the vcl only handles the TCP part of the equation. If your backend expect a specific host, you need to either have the client give it, or have varnish override it.<div dir="auto"><br></div><div dir="auto">Try curl -I localhost/your/file -H "host: <a href="http://whatever.your.host.is.com" target="_blank" rel="noreferrer">whatever.your.host.is.com</a>"</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 19, 2019, 09:02 Varun Nath <<a href="mailto:varunnath86@gmail.com" target="_blank" rel="noreferrer">varunnath86@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Yes, I tried with <a href="http://locahost" rel="noreferrer noreferrer" target="_blank">http://locahost</a>, but that is expected, right? since the backend server is configured in VCL file. Sorry if I am wrong</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 19, 2019 at 2:29 PM Guillaume Quintard <<a href="mailto:guillaume@varnish-software.com" rel="noreferrer noreferrer" target="_blank">guillaume@varnish-software.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Note: please keep the mailing list CC'd<div dir="auto"><br></div><div dir="auto">Check the host header you are sending to the backend. Usually, a 404 arises because the URL and/or the host wrong.</div><div dir="auto"><br></div><div dir="auto">I'm thinking you possibly tested varnish requesting something like <a href="http://localhost/your/test/file" rel="noreferrer noreferrer" target="_blank">http://localhost/your/test/file</a>, but your backend isn't configured to reply to the "localhost" host</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 19, 2019, 08:55 Varun Nath <<a href="mailto:varunnath86@gmail.com" rel="noreferrer noreferrer" target="_blank">varunnath86@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Thanks again for the quick response. <div>I have checked the log and getting the expected IP address in <b>BackendStart </b>parameter. Sorry I didnt get what you mean by you need to change <b style="font-style:italic">the host header before sending the request to the backend. </b>Could you please elaborate a little bit?</div></div><div><br></div><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 19, 2019 at 2:20 PM Guillaume Quintard <<a href="mailto:guillaume@varnish-software.com" rel="noreferrer noreferrer noreferrer" target="_blank">guillaume@varnish-software.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Hi,<div dir="auto"><br></div><div dir="auto">Use varnishlog -b (with possibly -d) to see the backend transactions and see what IP is being used (is it the right one). It could also be that you need to change the host header before sending the request to the backend.</div><div dir="auto"><br></div><div dir="auto">Cheers,</div><div dir="auto"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 19, 2019, 08:39 Varun Nath <<a href="mailto:varunnath86@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank">varunnath86@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello,<div>I need to connect to a remote host from local VCL config file. I have added the backend config as below</div><div><br></div><div>backend default {<br> .host = "<a href="http://remote.host.com" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">remote.host.com</a>"; <br>}</div><div><br></div><div>But am getting Page not available message. Do I miss something?</div><div>Thanks in advance<br clear="all"><div><br></div>-- <br><div dir="ltr"><span></span>VARUN NATH A V</div></div></div>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer noreferrer noreferrer noreferrer noreferrer" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><span></span>VARUN NATH A V</div></div></div>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><span></span>VARUN NATH A V</div>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><span></span>VARUN NATH A V</div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><span></span>VARUN NATH A V</div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><span></span>VARUN NATH A V</div>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><span></span>VARUN NATH A V</div>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><span></span>VARUN NATH A V</div></div>
</blockquote></div>
</blockquote></div>