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

A non pre-rendered page shows up instead of 404 page #32

Open
midhunpm opened this issue Nov 29, 2018 · 3 comments
Open

A non pre-rendered page shows up instead of 404 page #32

midhunpm opened this issue Nov 29, 2018 · 3 comments

Comments

@midhunpm
Copy link

Hi,
I am new to Ember and Prember. I have an application which I pre-render using prember during build time. All possible urls of the application are pre-rendered during build. However, when I try a url which is not in the pre-render list, the browser serves a page instead of a 404 page.
There are two scenarios:

  • I am on the home page, and there is a link that points to this unlisted page. My guess was that clicking the link would serve a 404 page but instead it served a page with some available data.
    Clicking the link actually transistioned the route from the landing page to this non pre-rendered url.
  • If land directly to this unlisted url or do a hard refresh, then I get a 404 page.
    How do I set this up to always serve a 404 page if a non pre-rendered page is requested?
    How do I make sure Ember app or fastboot doesn't do a network request and serve the non pre-rendered page?
@mansona
Copy link
Collaborator

mansona commented Nov 29, 2018

@midhunpm what is the use case that you're building against? Why don't you want it to show the Ember app and make a network request at runtime?

What you are experiencing is how Ember Fastboot (and therefore prember) is intended to work. It sounds like you're not configuring your webserver to send the "blank" Ember app in the case of a 404 (See the documentation here). But from the sounds of what you're saying this "fix" is the exact opposite of what you want 😂 what this would do would "fix" your second case so that when you do a hard refresh on a page that wasn't pre-rendered it would load the Ember app and not show a 404.

@ef4
Copy link
Owner

ef4 commented Nov 29, 2018

Your second scenario works because your web hosting will necessarily serve a 404 for missing pages.

For your first scenario: if the route is valid and can fetch valid data, there's no reason for it to 404. If you really don't want to show some route, then you should make sure that route's data is not available to the app (causing the model hook to throw an exception), and you can render a 404 page in the ember app itself using an error template.

Prember's urls option is only about controlling optimization. Leaving URLs out of it doesn't make them not valid URLs, and it certainly doesn't protect any data that might be behind other URLs.

@sandstrom
Copy link
Contributor

@midhunpm I'm doing some issue gardening 🌱🌿 🌷 and came upon this issue. Since it's quite old I just wanted to ask if this is still relevant? If it isn't, maybe we can close this issue?

By closing some old issues we reduce the list of open issues to a more manageable set.

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

No branches or pull requests

4 participants