Hacker News new | ask | show | jobs
by megaman821 4267 days ago
a) I just let Nginx do the redirect. Varnish can cache 302's so after the first one it won't hit Nginx again until the cache times out.

b) You have to terminate SSL connections before hitting Varnish. There is very little chance SSL termination will ever be part of Varnish. On AWS you can terminate with ELB.

c) Varnish can add HTTP headers and it will respect the headers your backend sets.

d) Varnish can disable caching for a specific path or again it will respect the No-Cache headers a backend sets.

1 comments

for b), we dont use AWS - we are hosted on Softlayer cloud. Does that mean that - if you use Varnish with SSL, then you NEED to use HaProxy ?

Or is it nginx (SSL termination) -> varnish -> nginx (server) -> Rails

Yes, I usually set up Nginx just to listen to port 443 and forward to Varnish on the same machine. You could do the same with HaProxy.

It is not as bad it seems since using Nginx to terminate SSL and forward is just a really simple config file. If you have a lot of cached resources then the path is mostly Nginx -> Varnish. Varnish is probably over 100 times faster than Rails at serving anything cacheable.