Showing posts from February, 2018

Redirection error Nginx + Varnish Solution - Solved

I recently enabled HTTPS on this site and wanted to use a 301 redirect in order to correctly re-route guests from HTTP to HTTPS (HTTP to SSL/TLS). I originally performed all of my rewrites in Apache which acts as my backend. While Apache handled the typical non-www to www redirects with ease, it created a redirect loop when attempting to redirect users from HTTP to HTTPS. I decided to let Varnish Cache 4 rather than the Apache backend handle the redirect. The documentation on the on the Varnish site is for Varnish 3 which is not compatible for Varnish 4 as of this writing: subvcl_recv{if(("^(?i)"||"^(?i)")&&req.http.X-Forwarded-Proto!~"(?i)https"){setreq.http.x-Redir-Url=""+req.url;error750req.http.x-Redir-Url;}}subvcl_error{if(obj.status==750){setobj.http.Location=obj.response;setobj.status=302;return(deliver);} After some research, I found a redirect exampl…

Reduce TTFB to less than a second with NGINX + FAST-CGI

Speed up website response times with nginx The why, when, and how of using nginx to cache a CMS's output. Prior to worrying about nginx... Nginx can't do much to help make a slow design and inefficient front-end code feel fast. A lot of what makes a web page fast or slow is down to design considerations and front end techniques. To that end I've so far implemented the following with my new website: Used a performance conscious design.Kept the core CSS relatively lean (32Kb before gzip).Minified the JS and CSS.Used Gzip to compress all appropriate files over the wire.Set appropriate cache headers for all content types.Used SPDY3 instead of HTTP1.Created image assets optimised via ImageAlpha and ImageOptim.Ensured that JS, CSS, and fonts are loaded asynchronously. The goal is to minimise the amount of 'stuff' needed on a page, and to stop any of that stuff from blocking page render. I do have a couple of things that are not quite optimal: I load three font files, whic…