Today at work, a feature I worked on went from fun and cool as I was building it to a stressful fix and recover operation after it unintentionally deleted important site files when deployed. Continue reading post "#2820"
cache posts
I was getting a white screen with 200 status in production after updating Symfony to 3.4. Continue reading post "#1696"
Logging service worker cache headers
As part of the service worker API, a cache interface has been provided to manag…
Continue reading post "Logging service worker cache headers"First play with service workers
I started playing with service workers as a client side cache manager a bit tonight. I'm using this Smashing Magazine article as a guide. I've been reading a bit here and there about them, intrigued by their role in making web sites installable as apps and their ability to allow sites to function even while offline. However, my site's current lack of pages and other priorities plus the learning curve and things that have to be done to set them up kept me from playing with them until now.
Workers require HTTPS, unless, luckily, you are serving from localhost. I had to modify my local app install to use that instead of the more site-indicative name it was using. They also require placement at or above the path level they apply to, or theoretically a Service-Worker-Allowed header, though I was unable to get that working. I'm assuming this is for some security reason. Because my file is stored in a Symfony bundle and because I am serving multiple sites with the same application, I didn't want an actual file in my web root. I made a Symfony route and action that passes through the file, like:
Ideas: Local + Proxy Remote Hosting for Personal Site
Hosting your personal website on a computer at your home puts extra indie in in…
Continue reading post "Ideas: Local + Proxy Remote Hosting for Personal Site"Symfony AppCache and 'X-Reverse-Proxy-TTL', a hack
Symfony's HttpCache reverse proxy is a simple way to get caching of pages with Symfony. It is simple to set up, easy to work with, and easy to clear. I started using it recently on my own site.
A simple app/console cache:clear will clear the entire cache. Otherwise, following the HTTP-oriented spirit of the framework, invalidation is based entirely on HTTP headers. In this way, it works the same as proxy / gateway caches. It only caches responses with public Cache-Control headers. It is age based, using the Cache-Control s-maxage or maxage values or Expires headers (following that order of precedence). It then considers the cached items fresh until they are stored for longer than those headers specify they can be stored. The cached version is served, bypassing the router / controller, as long as the cache is fresh.
This is all nice, but using long max-ages for those headers means that caches outside of my control can cache pages for long periods of time. cache:clear won't help when a page changes. One possible option would be to have shorter and safer max-ages as Cache-Control headers and use something else for HTTPCache.
Symfony AppCache: built in reverse HTTP proxy
I finally set up my site to work with Symfony's built in HTTP reverse proxy. T…
Continue reading post "Symfony AppCache: built in reverse HTTP proxy"