-
Notifications
You must be signed in to change notification settings - Fork 13
Edge Cache
Edge caching is handled via Nginx's built in HTTP caching.
Caching helps you speed up your website by saving responses and serving it directly from disk and memory. It also helps you handle high traffic loads and in some cases fight DDoS attacks. Nginx will almost always be able to serve more requests than your application because it does not have to perform any logic to generate responses.
The most commonly cached items are static content, such as images, videos, css, etc. These are perfect for caching because its contents are not dynamically generated. You can still cache dynamic content, but you must set an appropriate Edge Cache TTL and purge when necessary.
These are the default cache settings for Nginx used by LightPath. You can change these in your nginx.conf
file on line 115
Value: proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=global_cache:100m max_size=5g inactive=1d use_temp_path=off
- Store cache at
/var/cache/nginx
- Use 2 level directory hierarchy
- Max item size is 5 GB
- Delete items that haven't been accessed in 1 day (The max Edge Cache TTL for LightPath)
You can change these options on the dashboard under "Cache" or through the API at PUT - /v1/zones/:id/cache
Clear items from edge cache forcing requests to be forwarded to the origin. Wildcard paths are supported!
- Custom Purge - Purge specific items using URLs
- Purge All - Purge all items in zone from edge cache
The amount of time a cache item should be stored on an edge server
- Store cache for x amount of time - 30 minutes, 1 hour, 2 hours, 3 hours, 4 hours, 5 hours, 8 hours, 12 hours, 16 hours, 20 hours, 1 day
- Bypass Cache - Bypass edge cache and pull from origin
- Respect Origin - Use cache-control headers from origin
Sort query strings alphabetically, allowing files with different query string orders to be treated the same
Removes the set-cookie
header from origin server