-
Notifications
You must be signed in to change notification settings - Fork 414
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
Handling 404's #237
Comments
I thought with the new version, an explicit catch all route wasn't needed. @cmather ? |
I tested using notFoundTemplate:"not_found", but the head was still 200 after running this command on the terminal:
|
@Lepozepo I am also having trouble with 404's I have the @cmather to replicate this bug you can clone austinrivas.meteor.com on the iron-router branch at this commit All of my iron-router configs can be found in To run the app just |
As far as I understood about the way iron-router works with the notFoundTemplate key is that it depends on the data key to return true or false. If data returns false then notFound gets rendered. I don't know if doing that makes the header return the 404 though. |
@Lepozepo I don't think that is correct. It is my understanding that if the data property is set to false then iron-router just uses the last data context passed to a controller, allowing you to pass contexts from one page to the next. Pretty awesome feature if you ask me. iron-router readme covers this in the data section |
@austinrivas I didn't know that, that's pretty cool! |
Hey guys, The way data works has been updated a bit and the README was a little behind. If you call On 404, remember this is happening client side. If you use On the server, there is no default 404 behavior yet. |
Is there any way of making both the client and the server respond with the 404? Basically push a template client side but put the 404 headers server side? Or is that a conundrum? |
It's a bit of a conundrum. The reason is that in case of 404, we need to call out to the server from the client in case the URL will be handled by a file in I'm not sure there's a better solution to all this but this is what we are doing for now. |
Yeah, I figured. Do you think rendering a 404 template will have a negative impact on search engines? I have no clue but I would suspect crawlers prefer a 404 from the server to a 404 from a template right? |
I guess a search engine isn't going even realise its a "404" on the client because it'll be served with a 200 header. But hopefully there won't be too many broken incoming links to your app :) |
I wonder what the latest status on this is. It is currently very easy to carry out an seo-attack on a meteor page by submitting non-existent links from that app on random places on the internet. Google will quickly crawl those links, parse the pages, think that the site has some kind of automated duplicate content on thousands of non-existent pages, and boom, ranks fall. Also, by way of submitting a large number of links and thus getting google to crawl them, we can create a virtual DOS attack by means of google spiders since they will visit back seeking for changes on those links while they would not have were them proper 404 errors. |
Server side 404s handled much better in the refactor branch. If no route defined the server sends a 404. Feedback on the approach would be great. Go check out router_server |
Can you provide a working example of how to use router_server? I already use the notFoundTemplate option in Router.configure, however this should also correctly return 404 as described above by @serkandurusoy Thank you, |
@cmather can you please explain what you mean by "router_server" ? Ive read the docs and they dont mention anything like this. I am interested in the 404 fix. Thanks in advance! |
This is great. This doesn’t really address @serkandurusoy ’s concerns though.
Currently the client can request I understand you would need to put this logic on the server then, but only for the initial page load… Cheers, |
That's right. For example http://demo2.telescopeapp.org/posts/should-return-404 or at least http://demo2.telescopeapp.org/posts/should-return-404?_escaped_fragment_= should return 404 whereas I'm getting 200. A proper 404 is crucial for search engine optimization and returning 200's for non-existing pages has penalties in the form of duplicate content So, the ability to return 404 on the server side on purpose, while good, is irrelevant in this case. |
Waiting so much the 404 status server side. Router.route('oldroute', { This can handle the case when Google crawls old routes. However, a blank page is rendered... |
if you change route names, you might be better off with a 301 instead of a On Tue, Dec 9, 2014 at 1:09 PM, Jean-Noël KIEN notifications@github.com
|
I'm loving 0.6.0, it's great! Is there any particular way to handle 404's and render a template? This is what I'm currently doing:
When I uncomment the template I still can't get anything to show but at least the headers are right. Is there any way to render a static template after the response?
The text was updated successfully, but these errors were encountered: