0

I'm using nginx to serve static files. I have several js files and different client require different combination of the available files. Is it possible that nginx will combine the files in the request in the first time and then on subsequent requests will serve the cached combined version? Every time I'll upload a new version I'll just clear the cache folder.

Do I need to use a separate script to do it? Is it possible to use python? I rather have simplicity then speed because creating a new combination won't happen to frequently.

Client will request something like http://www.example.com/static?file1_file2_file2.js

Thanks

1 Answers1

1

Hey, you can gzip the js files based on the file type:

gzip  on;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_buffers 16 8k;

The caching part is not clear, I think those files are going to be in the operating system file system cache which is fast enough...

Istvan
  • 2,582
  • 3
  • 22
  • 29