Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sw360-dev] nxginx and caching of 100s of css files ...

Hi,

we discussed the thing that a single page load involves somewhat between 110-140 individual GET requests, vast majority is for *.css, *js and such files.

I tried to enable caching for nginx, actually was kind of not so obvious, because it needs to be applied for the proxied traffic (coming from tomcat, which sets the http fields already), so plain nginx configurations from the Web did not work.

What does seem to work is:


    location ~*  \.(jpg|jpeg|png|gif|ico|css|js)$ {

        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_redirect off;
        proxy_pass  http://liferay-app;
        proxy_read_timeout 3600s;

        proxy_set_header expires 7d;
    }

-> just adding the proxy_set_header to the proxied http header fort he expires value.

Question: shall we take this into the deployment setting of nginx fort he sw360chore project? It is maybe not useful for development, but  for proudction use it appears like a useful additon. on a quick testign it seem sto reduce the load timest by 25-50% - admitted not really tested, because I did not ensure for same server conditions ...

Kind regards, Michael


Back to the top