Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Eorror.page status code
PRK
We have a page-not-found.page configured as the error page for a LiveSite site. In the runtime this page is working fine (coming up for urls to a page not present in the server), however the error status code returned by the page is 200. Is there a way to configure/change this to the standard page not found error code i.e. 404?
Thanks,
PK
Find more posts tagged with
Comments
Rick Poulin
Really? I thought it already sent a 404 response when the page was not found (accessing the error page directly, however, returns a 200). In any case, the simplest solution I can think of is to add an external to the error page, which gets the HttpServletResponse from the RequestContext, and does response.setStatus(404), returning an empty XML doc.
tec_iwov
you could also do this with a controller
Rick Poulin
you could also do this with a controller
Right, good call. Pre-controllers are intended for this type of thing -- I don't remember if it's too late to modify the status code by the time the externals are executed (the HTTP headers may have already been sent and the response body may already by streaming).
PRK
Btw this is TeamSIte7.2.1 on a .net platform.
I tried dropping .net controls on the page not found page, in a component, to set the response status code to 404. This seems to be working fine.
It seems a good idea to use the pre-controllers though, I'll try that out too.
Thanks,
Pranav.