Just sharing some problems I ran into when doing this guide: If you run into "Error 503 Backend fetch failed" all the time, it may be because varnish cannot find your services that your run on localhost. If you are on Mac (may work on other OS too), you will have to type the following to connect to a service running on your own machine outside docker (where host.docker.interal will resolve to to where docker thinks your local machine is relative to its own network): backend default { .host = "host.docker.internal"; .port = "3007"; } This took me a long time to figure out so wanted to share it. Also, if you run into problems with the caching not working, make sure you are not sending cookies or setting no-cache headers in the request as this makes varnish not cache by default. Otherwise, thanks for a good video Hussein!
Thank you! You directed me to the right solution! I had to change port because my next.js app is by default launched on port 3000. So I needed to have following configuration: backend default { .host = "host.docker.internal"; .port = "3000"; }
Bro Hussain, first of all, I would like to thank you for your efforts and the time you've spent to come out with this masterpiece channel. great job, it was very helpful indeed. Q) Don't you think that when we used different technologies from different authors working very similar things will cause data delay? speed is one of the important factors. I think one technology will achieve 4 tasks in 1 environment, for example, we can use Nginx to listen to port 80 and/or 443 terminations in the frontend as well as a load balancer + Caching in the backend. please correct me if I am wrong. Regards
great video Hussein. Any idea what this would look like if we have four of the main web servers with an azure load balancer. Where does the varnish go into that design?
Behind your loadbalancer would make the most sense, the LB can handle ssl termination and then forward requests to varnish, if you would use HAProxy as LB you would be able to do some really advanced stuff together with Varnish
Thank you! Do you know how this could be combined with jwilder/nginx-proxy? I get a 503 error when I reach my server since Im using jwilder. Help would be greatly appreciated.
I am running a website on HTTP/2, was thinking of installing Varnish and came across your video. Just curious a bit further on the CONS site.. so if the server runs on HTTP/2, varnish has no benefit?
Hey Wesley, I don’t have a strong opinion it depends on how much fine control you want. Cloudflare will take care of a lot of caching and optimization for you that You will have to manage manually with Varnish. Varnish will give you control and customization through VCL. One option is cheaper than the other
@@hnasr thank you a lot Hussein, my hoster for my shared hosting WordPress website has a special "WordPress" varnish settings and provides it for free. (In dutch: www.vimexx.nl/help/varnish-cache-inschakelen). Do you have an opinion in this specific case? :) Thank you a lot!
So basically, it's just an ordinary reverse proxy like nginx/haproxy? But has a lot of limitations compared to them. Looks like a useless thing for me...
Classic HTTP Architecture : 1:53
How Varnish Works 3:50
Demo HTTP 7:50
Demo HTTPS 18:23
Varnish Pros 28:43
Varnish Cons 39:26
Just sharing some problems I ran into when doing this guide: If you run into "Error 503 Backend fetch failed" all the time, it may be because varnish cannot find your services that your run on localhost. If you are on Mac (may work on other OS too), you will have to type the following to connect to a service running on your own machine outside docker (where host.docker.interal will resolve to to where docker thinks your local machine is relative to its own network):
backend default {
.host = "host.docker.internal";
.port = "3007";
}
This took me a long time to figure out so wanted to share it.
Also, if you run into problems with the caching not working, make sure you are not sending cookies or setting no-cache headers in the request as this makes varnish not cache by default.
Otherwise, thanks for a good video Hussein!
Thank you! You directed me to the right solution! I had to change port because my next.js app is by default launched on port 3000. So I needed to have following configuration:
backend default {
.host = "host.docker.internal";
.port = "3000";
}
gets so happy: "I can refresh all day"
Incredibly good beginners guide to Varnish. Great balance between basic and more advanced stuff. Thanks alot!
Robert Carlsson thanks Robert! Appreciate you
I really like the way you talk about this stuff ;)
Only watched one video of yours so far but you're fantastic. Gonna check out more!
Bro Hussain, first of all, I would like to thank you for your efforts and the time you've spent to come out with this masterpiece channel.
great job, it was very helpful indeed.
Q) Don't you think that when we used different technologies from different authors working very similar things will cause data delay?
speed is one of the important factors.
I think one technology will achieve 4 tasks in 1 environment, for example, we can use Nginx to listen to port 80 and/or 443 terminations in the frontend as well as a load balancer + Caching in the backend.
please correct me if I am wrong.
Regards
Teaching is an Art, and you dear sir, you are an ARTIST!
Perfect 👍👍👍 god bless you 🙏
Thanks Abdalla!
This is excellent sir
Great video, but personally I will go with Redis to have greater control as you said and by avoiding an extra hop for all the requests.
What happened before 17:45 so that the timestamp changed with varnish too?
I am proud of you son.
Today I learned ❤❤❤
great video Hussein. Any idea what this would look like if we have four of the main web servers with an azure load balancer. Where does the varnish go into that design?
Behind your loadbalancer would make the most sense, the LB can handle ssl termination and then forward requests to varnish, if you would use HAProxy as LB you would be able to do some really advanced stuff together with Varnish
Awesome awesome stuff. Amazing teacher you are Hussein
Great video
Can you please make varnish -> nginx -> Apache configuration ? Thanks
Thank you! Do you know how this could be combined with jwilder/nginx-proxy? I get a 503 error when I reach my server since Im using jwilder. Help would be greatly appreciated.
I am running a website on HTTP/2, was thinking of installing Varnish and came across your video.
Just curious a bit further on the CONS site.. so if the server runs on HTTP/2, varnish has no benefit?
Danke!
Really helpful ..thanks
Hussein thanks for this tutorial it was helpful. Is there any way to trace varnish logs?
finally u did it
Yes! you are one of the people who requested this video ALOT.. enjoy!
@@hnasr what would be next video about? and when?
rahul kumar singh there is a video that went out today about spinning lightweight container that run Javascript code. Tomorrow’s video VPN vs Proxy
Do you need Varnish if you have a configured CDN?
If the CDN does caching for you (which probably they do) then I think you don’t need it necessarily
Can we use Varnish as cache proxy as frontend for docker registry? Hope varnish can cache docker images? If yes, is it feasible solution?
watch this in at least x1.5 for a better experience
Hey Hussein, do you recommend to use Apache + varnish or Apache + cloudflare?
Hey Wesley, I don’t have a strong opinion it depends on how much fine control you want. Cloudflare will take care of a lot of caching and optimization for you that You will have to manage manually with Varnish.
Varnish will give you control and customization through VCL.
One option is cheaper than the other
@@hnasr thank you a lot Hussein, my hoster for my shared hosting WordPress website has a special "WordPress" varnish settings and provides it for free. (In dutch: www.vimexx.nl/help/varnish-cache-inschakelen).
Do you have an opinion in this specific case? :) Thank you a lot!
can we use varnish as youtube cache?
i need hep to built the right cache server
But varnish is like a thousand times faster than having your web server and libraries compile to run redis to return a response...
Bad for WP?
Who is the certificate authority?
I talk about CA here ruclips.net/video/x_I6Qc35PuQ/видео.html
@@hnasr Thanks for replying, but I mean the authority of this https certificate. 😉
So basically, it's just an ordinary reverse proxy like nginx/haproxy? But has a lot of limitations compared to them. Looks like a useless thing for me...
Hardest problem in computer science? Are you willing to repeat that claim in front of the audience in my theoretical computer science lecture hall? :D