Http-server: Doesn't update changes made on html files

Created on 20 Jun 2016  路  19Comments  路  Source: http-party/http-server

When I'm changing the content in an Angular app , I don't restart the server just refresh the browser, it still shows old content .
What o do here ?

duplicate faq

Most helpful comment

The http-server docs mention that there's a parameter to configure the cache-control header, and it fixed the problem. The fix is to change this line in package.json:

"start": "http-server -a localhost -p 8000",
to

"start": "http-server -a localhost -p 8000 -c-1",

All 19 comments

http-server serves an ETag with every response to tell the browser if the content changed. If I serve a directory containing foo.html and then modify foo.html, it correctly updates the ETag. Therefore, Firefox shows me the updated version of the file.

Same issue. Doesn't update changes made on html files

Please check with the dev tools if http-server serves a different ETag or the same together with an 304 Not modified header.

Its working fine, sends the same together with an 304 Not modified header.

So why should something else be shown then? If the response hasn't been modified since the last request.

@derhuerst I just mean that as its absolutely working as expected so issue can be closed.

I have the exact same case with html files. In my case I modified one of my html file, refreshed chrome browser but http-server served with old last-modified date and same etag. The cache-control:max-age=3600 header was set. After 3600s chrome does invalidate the cached html file and gets a new one.

So I guess for some reason http-server is serving cached files. I wonder why!

I am on a Windows 10 machine, Chrome 53.0.2785.116 m.

Is this issues related to this: #207 ?

@ObaidUrRehman [email protected] has bedn released, including the #207. What is your http-server version? You can check with npm ls --depth 0 or npm ls -g --depth 0.

@derhuerst I am using http-server0.9.0 yet I still get this issue. My node is v4.4.4.

Would you mind updating to 4.4.7 or 4.6.0? I haven't checked, but there might have been bugfixes related to this.

I am using http-server0.9.0 and nodejs v6.9.1 and npm 1.4.21. I have same issue.

I run http-server -c-1 to disable caches. Works well. Very refresh friendly. :)

Also using [email protected] and Node v6.9.5 LTS on window 8s, not able to disable the caching, tried chrome and forefox with devtools open, caching disabled, but same issue: always one or some more seconds of caching

Using node v6.11.2 and [email protected] on windows 7.
Same issue. Doesn't update changes made on html or js files.
What can i do? I've already try http-server -c-1
Restart my machine every time i want to host my own app is hard.

The http-server docs mention that there's a parameter to configure the cache-control header, and it fixed the problem. The fix is to change this line in package.json:

"start": "http-server -a localhost -p 8000",
to

"start": "http-server -a localhost -p 8000 -c-1",

@aretw0 Are you still seeing the same behavior on the latest versions of http-server and node?

@aretw0 Are you still seeing the same behavior on the latest versions of http-server and node?

I am currently experiencing this issue on v 0.11.1 with the following start script: "start": "http-server -p ${PORT:=5000} -c-1",

@aretw0 Are you still seeing the same behavior on the latest versions of http-server and node?

@thornjad
I'm not using http-server so frequently, not anymore. I think this behaviour is more about the SO than something else.

Closing as a duplicate of #149 which is solved by #326

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arthurkhlghatyan picture arthurkhlghatyan  路  3Comments

dKab picture dKab  路  7Comments

jiyinyiyong picture jiyinyiyong  路  6Comments

lacivert picture lacivert  路  3Comments

gerkirill picture gerkirill  路  3Comments