Disable caching when serving ionic static files with Nginx


#1

We have an Ionic project, and we want to host some of these files on a web server (Nginx). Since then users needn’t update app version to get new changes. We’d like to disable caching so that each change is propagated to the server (like ionic serve). The configuration of the Host is quite simple:

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

root /home/litingjun/IonicProjects;
index index.html index.htm;

server_name localhost;

location / {
try_files $uri $uri/ =404;
add_header Cache-Control private;
expires 0;
}
}

When we access a HTML file http://localhost/bizapp/v2-phone/www/#/tab/index/balance, Once the file is changed, we still get the old text. (use backward and enter this page again) If we press refresh button(F5), new content will be loaded. (but on telephone, there is no refresh option)

Our nginx server is not running on VirtualBox.

How can we make Nginx livereload files? Thanks.


#2

Now we choose to use Cordova Hot Code Push Plugin to fullfil our requirement.