Nginx caching of index.html

798 views
Skip to first unread message

Gal Ben-Haim

unread,
Dec 9, 2012, 7:36:53 AM12/9/12
to ang...@googlegroups.com
I'm using angular.js with a remote API, so in order to solve cross domain requests issues I use nginx to serve static files and to proxy the remote server to /api/

the problem is that because of Nginx caching things won't get updated unless the user refreshes the web page.

how can I solve this ?

is there a better way to access remote APIs ?

Pawel Kozlowski

unread,
Dec 9, 2012, 7:41:13 AM12/9/12
to ang...@googlegroups.com
Hi!

On Sun, Dec 9, 2012 at 1:36 PM, Gal Ben-Haim <gben...@gmail.com> wrote:
> is there a better way to access remote APIs ?

There are only 3 possibilities AFAIK:
1) proxing (your approach)
2) JSONP (limited to GET...)
3) CORS: http://www.html5rocks.com/en/tutorials/cors/

If CORS works for you it might be a good alternative.

Cheers,
Pawel

--
Question? Send a fiddle
(http://jsfiddle.net/pkozlowski_opensource/Q2NpJ/) or a plunk
(http://plnkr.co/)
Need help with jsFiddle? Check this:
http://pkozlowskios.wordpress.com/2012/08/12/using-jsfiddle-with-angularjs/

Looking for UI widget library for AngularJS? Here you go:
http://angular-ui.github.com/

Peter Bacon Darwin

unread,
Dec 9, 2012, 9:51:10 AM12/9/12
to ang...@googlegroups.com

Can't you configure nginx not to cache certain urls?

Pete
...from my mobile.

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en-US.
 
 

srinivasa varma

unread,
Jul 22, 2013, 9:28:03 AM7/22/13
to ang...@googlegroups.com
Hi,

How did you solved this problem? am also getting the same problem.

Can you please share the solution..

Thanks 

Gal Ben-Haim

unread,
Aug 3, 2013, 3:33:21 AM8/3/13
to ang...@googlegroups.com
You can add a revision as a query parameter to the JavaScript URL, it won't be cached.
for example <script type="text/javascript" src="myfile.js?r=1 />


--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/kSZ701v8kxI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.

To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages