http-server
http-server copied to clipboard
html documents served are downloaded
http-server example on this page https://stackabuse.com/how-to-start-a-node-server-examples-with-the-most-popular-frameworks/ Tell us about your environment
- exact http-server version: 0.12.1
- Node version: 12.16.2
- Platform: Win10
Other information (related issues, suggestions for a fix, etc): Just learning about the server but when it goes to serve the example page it downloads it instead of displaying it. Does this in both Chrome and Firefox (latest versions). Any chance you could explain what I am doing wrong if this is my issue? Thanks.
I can at least confirm the Firefox behavior, it's working on chrome (latest)
What does the file you're trying to serve look like? Does it have the file extension .html
? Do other servers serve it properly?
index.docx
Thanks
for your reply. This is happening on both Chrome and Firefox.
This is the code of index.html. It was originally a visual studio code template, but I added to it to see if that helped.
Is the file actually called index.docx
? If so, that makes it a Microsoft Word document, which should be downloaded. There isn't really any way for a regular web server to serve a file like that.
No, I just put it into a docx file so you can see it - I couldn't upload the html file.
Thanks
On Mon, Apr 27, 2020 at 11:02 PM Jade Michael Thornton < [email protected]> wrote:
Is the file actually called index.docx? If so, that makes it a Microsoft Word document, which should be downloaded. There isn't really any way for a regular web server to serve a file like that.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/http-party/http-server/issues/623#issuecomment-620042672, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTBA4ZWTGRCPCU7MGUBC4DROWNBLANCNFSM4ML2UI5A .
This is probably a problem with the http response header. Maybe Chrome fixes it, but firefox doesn't. If you serve a file with de content-type header 'test/html' (notice the typo!), firefox will download it.
Seems like a duplicate of https://github.com/http-party/http-server/issues/657 . A complete list of response headers might help debugging this.
This issue has been inactive for 180 days