http-party / http-server

a simple zero-configuration command-line http server
MIT License
13.6k stars 1.49k forks source link

files not updating unless cache is force-cleared #149

Closed mix3d closed 6 years ago

mix3d commented 9 years ago

I'm developing a Backbone based app, and the text.js package of require.js appears to be creating a conflict with how files are returned.

If I change one of the template files that is read by text.js, and refresh the page, the content is not updated accordingly; the template file is cached, even with a "hard refresh". Nothing short of forcing a "Empty cache and hard refresh" (right click on refresh button in chrome) will update correctly.

I have tried the -c-1 and -c0, even -c1 params to set the caching parameters when starting, but to no avail.

TheGreatPanda commented 9 years ago

universe

thebucknerlife commented 9 years ago

Same for me. Working on an angular app and some local template changes simple don't propogate without a server restart.

ptim commented 9 years ago

I was having an issue with stale content, but I think it may have been down to expecting the order of args to be other than they are documented.

http-server tests/results -c-1

works for me, whilst:

http-server -c-1 tests/results 

..does not. hth

(I find the order of arguments inconsistent with other CLI utilites... )

http-server -h for help..

rayshan commented 9 years ago

Confirming order of args does matter and @ptim's solution of putting -c-1 at the end works. Thanks!

capaj commented 8 years ago

I ran into this issue today with my https://github.com/capaj/jspm-react My files are always loading cached. Only way to get a fresh version is to check Disable cache (while DevTools is open) and leave it opened. I even run http server with cache set to -1 and it still loads cached files.

SiZapPaaiGwat commented 8 years ago

@czpilar I got this problem too on windows!!!

Zyles commented 8 years ago

Same problem. Changing template files in angular does not update the content on refresh.

hemantjeengar commented 8 years ago

adding -c-1 at the end worked for me. Thanks

ujulitos commented 7 years ago

"-c-1" does not work without "-a localhost -p 8000".

yuricamara commented 7 years ago

@ujulitos This worked for me. Thanks!

NathanLebon commented 7 years ago

It seems like changing the port + adding "-c-1" made it for me indeed. A simple "http-server -c-1 -p 8010" should work. Consider using a port you did not used before.

jareware commented 7 years ago

Since many people use this as a development server, I don't think it would be unreasonable to default no disabling all caching. Or at least support ETag's.

bwamie commented 7 years ago

'http-serve -o -o' worked for me.

javenschuetz commented 7 years ago

"http-server -c-1 -p 8010" worked for me, but "http-server -c-1" did not. Thanks for posting solutions everyone <3

radinreth commented 7 years ago

http-server -c-1 is not working because it is already cached your content at the default port 8080, you have to change to different port with option -c-1.

> http-server -c-1 -p 8000
the94air commented 6 years ago

@NathanLebonCGI that worked. Thanks.

blitzerpl commented 6 years ago

@radin-reth Do you know how to clear cache on a specific port?

KBPsystem777 commented 6 years ago

This worked for me: http-server -c-1 -p 8010

BigBlueHat commented 6 years ago

We've also recently added a note to the README https://github.com/indexzero/http-server/commit/b9b95b25eaf90993b2406555a2f56c3a8cc9072f which I hope sufficiently clears up confusion for new comers.

I'm closing this as there's no clear remaining actions to take.

However, if anyone has new caching related concerns please file an issue (ideally with tests! 😁).

Thanks, all! 🎩

MrHuntix commented 6 years ago

crtl+reload helped me

rook2pawn commented 4 years ago

@BigBlueHat I dont think its sufficient. I tested this with -c-1 and it only forces cache clear with -p 8000 (for example) port specification. Just like a few others in this thread have already mentioned. In other words, I would recommend either the bug be reopened or re-evaluated. I have not seen any comments confirming that simply -c-1 without a port specification works for them.

let me clarify what I just said:

if you put the port specification, then -c-1 will work. If you don't put the port specfication, -c-1 will not work.

mrgenesis commented 4 years ago

"http-server -c-1 -p 8010" worked for me, but "http-server -c-1" did not. Thanks for posting solutions everyone <3

I just did achive after put other port. http-server path/to/folder -c-1 -p xxxx

AB498 commented 1 month ago

I was using -p parameter already and setting -c-1 alone wasnt enough, but then I hard reloaded the page and it worked.