June 22, 2018 12:54PM
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@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@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

NGINX Proxy Cache Cache-Control

Szop June 22, 2018 03:42AM

Re: NGINX Proxy Cache Cache-Control

pbooth June 22, 2018 12:54PM

Re: NGINX Proxy Cache Cache-Control

Szop June 26, 2018 12:48AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 248
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready