NGINX Proxy Cache Cache-Control
Peter Booth
peter_booth at me.com
Fri Jun 22 16:51:17 UTC 2018
Your question raises so many other questions:
1. The static content - jpg, png, tiff, etc. It looks as though you are serving them your backend and caching them. Are they also being built on demand dynamically? If not, then why csche them? Why not deploy them to nginx and serve them directly?
2. The text content - is this fragments of html that don’t have names that end in html?
Sent from my iPhone
> On Jun 22, 2018, at 3:42 AM, Szop <nginx-forum at forum.nginx.org> wrote:
> Something
> Hello guys,
>
> I'm having a hard time defining a proxy cache because my landing page
> doesn't generate any HTML which can be cached. Quit complicated to explain,
> let me show you some logs and curl requests:
>
> curl:
>
> curl -I https://....info/de
> HTTP/1.1 200 OK
> Server: nginx
> Date: Thu, 21 Jun 2018 11:56:15 GMT
> Content-Type: text/html;charset=UTF-8
> Content-Length: 135883
> Connection: keep-alive
> Keep-Alive: timeout=5
> X-Magnolia-Registration: Registered
> Access-Control-Allow-Origin: ...
> Access-Control-Allow-Methods: GET, OPTIONS, HEAD
> Access-Control-Allow-Headers: X-PINGOTHER, Origin, X-Requested-With,
> Content-Type, Accept
> Cache-Control: max-age=60, public
> Expires: Thu, 21 Jun 2018 11:57:15 GMT
> Last-Modified: Thu, 21 Jun 2018 11:55:46 GMT
> X-UPSTREAM: 10.6.198.11:8080
> ...
>
> NGINX Access Logs:
>
> [22/Jun/2018:09:35:24 +0200] Cache: - 10.6.198.12:8080 0.022 304 865 IP
> ...-com.stage.....info /de
> [22/Jun/2018:09:35:26 +0200] Cache: HIT - - 200 1151 IP
> ...-com.stage.....info /.resources/img/favicon.ico
>
> NGINX Locations:
>
> location ~*
> \.(?:bmp|css|gif|ico|jng|jpe?g|js(on)?|png|svgz?|tiff?|wbmp|webp)$ {
> # caching
> expires max;
> proxy_cache stage.....info_proxy-cache;
> proxy_cache_lock on;
>
> # custom lines
> proxy_cache_use_stale error timeout updating invalid_header http_500
> http_502 http_503 http_504;
>
> # proxy pass
> proxy_pass http://public.stage;
>
> }
>
>
> location ~* \.(?:html)$ {
> # caching
> expires 15s;
> proxy_cache stage.....info_proxy-cache;
> proxy_cache_lock on;
>
> # custom lines
> proxy_cache_use_stale error timeout updating invalid_header http_500
> http_502 http_503 http_504;
>
> # proxy pass
> proxy_pass http://public.stage;
>
> }
>
> I'm able to cache all static assets with proper file extension like .png,
> .css, etc. pp. so this works like expected. My question is: is it possible
> to define the caching behaviour because of the Cache-Type? My idea is to
> take the result like "Content-Type: text/html;charset=UTF-8" and then to
> proxy cache it if it is text/html. Does it make sense?
>
> Cheers,
> Szop
>
> Posted at Nginx Forum: https://forum.nginx.org/read.php?2,280242,280242#msg-280242
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
More information about the nginx
mailing list