Giter Club home page Giter Club logo

Comments (11)

cmwelsh avatar cmwelsh commented on May 5, 2024 6

Perhaps unrelated but it would be nice to specify an explicit fallback page (i.e. ./index.html) to support almost-static single page applications that change the URL using pushState. I could see that this is outside the scope of your project though...

The issue with using a default 404 page is that the server will still return an error status code in the HTTP response. Since I'm just using http-server as a simple documentation viewer... it's not a big deal.

from http-server.

jaap3 avatar jaap3 commented on May 5, 2024 6

This works unless you use the -P / --proxy flag.

Single page apps can just symlink index.html -> 404.html and everything works. The server will still respond with a 404 code, but that shouldn't matter in most use cases.

from http-server.

cmwelsh avatar cmwelsh commented on May 5, 2024 4

👍 I want to load my single page application if the file does not exist on the filesystem

from http-server.

indexzero avatar indexzero commented on May 5, 2024

We don't use node-static anymore. Is this possible with ecstatic now @jesusabdullah? I read the code but it wasn't totally obvious to me at a quick skim.

from http-server.

jfhbrook avatar jfhbrook commented on May 5, 2024

yes, ecstatic does this, and has for some time.

from http-server.

indexzero avatar indexzero commented on May 5, 2024

Ok, going to reopen this because we need to expose it through the http-server CLI. Is there an example of how to use this functionality in ecstatic? The option is really illuding me when reading the source.

from http-server.

indexzero avatar indexzero commented on May 5, 2024

@jesusabdullah specifically I am talking about custom 404 pages. Maybe that wasn't what you meant when you opened this issue.

from http-server.

jfhbrook avatar jfhbrook commented on May 5, 2024

It's automatic, unless handleError is turned off.

from http-server.

soluml avatar soluml commented on May 5, 2024

@cmwelsh realize this is a 6 months later, but 👍! Actually was looking at the repo today to see if this was a planned feature. I love this little server, but I can't use it for my SPA's with "html5mode" on for this reason.

from http-server.

thecotne avatar thecotne commented on May 5, 2024

any progress on this?

from http-server.

BigBlueHat avatar BigBlueHat commented on May 5, 2024

The 404.html file thing has been handled by node-ecstatic for awhile now. I've added a note about it to the README 9571d0a to close this issue.

Thanks, all!

from http-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.