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

Always serve index page for --pushstate #53

Merged
merged 1 commit into from
Aug 21, 2015

Conversation

scothis
Copy link
Contributor

@scothis scothis commented Aug 5, 2015

For applications that utilize HTML5 pushstate to mange the URL, it's
desirable for the server to always return the index.html page instead of
a 404.

Passing --pushstate on the command line will return the index.html if
no other resource matches the path.

Issue: #41

For applications that utilize HTML5 pushstate to mange the URL, it's
desirable for the server to always return the index.html page instead of
a 404.

Passing `--pushstate` on the command line will return the index.html if
no other resource matches the path.

Issue: mattdesl#41
@mattdesl
Copy link
Owner

mattdesl commented Aug 5, 2015

Looks great, thanks! About to get on a plane for vacation so I won't be near a computer for a couple weeks. Will review after. 👍

@scothis
Copy link
Contributor Author

scothis commented Aug 5, 2015

@mattdesl sounds good, enjoy the time off

@ashaffer
Copy link

@mattdesl any updates on getting this merged? I'd really like to have it. Awesome project btw!

mattdesl added a commit that referenced this pull request Aug 21, 2015
Always serve index page for --pushstate
@mattdesl mattdesl merged commit a16b86a into mattdesl:master Aug 21, 2015
@mattdesl
Copy link
Owner

Pushed to 4.2.0 😄 thanks for the PR!

@bendrucker
Copy link
Contributor

Love it -- can move fully off wzrd now!

@mattdesl
Copy link
Owner

mattdesl commented Dec 2, 2015

I haven't used this feature much, but it looks like the current --pushstate feature will also re-route missing JPG, CSS, etc files to /. Is there a suggested fix for that?

@mattdesl
Copy link
Owner

mattdesl commented Dec 2, 2015

Also it looks like localhost:9966/foo is being treated differently than localhost:9966/foo/.

@scothis
Copy link
Contributor Author

scothis commented Dec 2, 2015

If you set the status code to 404, the browser will ignore it for other resources types. Although it's a little funny that the expected html page is sent as a 404, the browser will render the page as expected.

The other option is to inspect the Accepts header to see what the expectations for the response are. This will be hard to test as every browser does it differently.

mattdesl added a commit that referenced this pull request Jan 28, 2017
Always serve index page for --pushstate
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.

4 participants