Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push state option #194

Closed
wants to merge 11 commits into from
Closed

Conversation

eerwitt
Copy link

@eerwitt eerwitt commented Oct 14, 2015

First try at implementing an option to support push state by rewriting all request URLs to use /index.html instead of the URL requested.

Does this conflict with other options? I'm concerned about changing the requested URL.

This was originally requested as part of #80

@eerwitt
Copy link
Author

eerwitt commented Oct 15, 2015

Noticed that this doesn't work well if you're including JS files as well. Going to update to make it work as a fallback so if a file exists it is served.

@eerwitt
Copy link
Author

eerwitt commented Oct 15, 2015

Updated logic in 5dd25b5.

@barroudjo

This comment has been minimized.

@riceboyler
Copy link

I agree with @indexzero, this is a better implementation than #205. +1 for the merge.

@TimofeyBiryukov

This comment has been minimized.

@dara76

This comment has been minimized.

1 similar comment
@scottwio

This comment has been minimized.

@schickling

This comment has been minimized.

@anarh

This comment has been minimized.

@anarh

This comment has been minimized.

@aaronshaf
Copy link

@indexzero Could you merge this?

@sgtpep
Copy link

sgtpep commented May 27, 2016

Nice implementation that doesn't disable directory listing. It looks like somebody has published it to npm: https://www.npmjs.com/package/spa-http-server.

@hugomn

This comment has been minimized.

@allanmc

This comment has been minimized.

@joshvillbrandt
Copy link

Used the spa-http-server npm package as suggested and then enabled the --push-state option. Works like a charm. Thanks!!

@Anas9598
Copy link

Anas9598 commented Feb 8, 2018

Has anyone here tried it along with setting proxy option for http-server (-P www.something.com)?
It works for me as long as I am not setting the proxy.

@ekulabuhov
Copy link

How to use spa-http-server in SPA mode:

  1. Install it with npm i spa-http-server -g. It installs 2 global binaries hs and http-server.
  2. Use it http-server --push-state.

This is what you should see:
screen shot 2018-04-11 at 10 58 40

@luanpotter
Copy link

@ekulabuhov, thanks for this! Where is the code for this spa-http-server fork?

Could this be merged over? It's an amazing feature and spa-http-server works like a charm for me!

@thornjad
Copy link
Member

We're adding a "self-proxying" approach to the README to address this issue, see #513

That should address this sort of usage without breaking the focus of this project on providing accurate HTTP responses. spa-http-server is available as a fork which focuses on SPA usage.

@thornjad thornjad closed this Apr 17, 2019
@thornjad thornjad mentioned this pull request Dec 6, 2021
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.