Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Custom Error Pages
I’m trying to get Textpattern’s custom error page feature to work with mod-security. The standard 404 handler works as expected. But what about other errors that might be generated by mod-security, such as 400, 403, 501, etc.? These are not being handled. I have tried adding Apache ErrorDocument commands to my Apache configuration, but that does not seem to be helping, and I am unclear on how exactly these mechanisms interact (Apache ErrorDocument + Mod-Security + Textpattern).
If anyone has some experience in getting this to work, I’d love to hear how you did it.
Thanks!
Offline
Re: Custom Error Pages
Hmmm. Nobody has any idea how this works? Maybe the devs could chime in?
Offline
Re: Custom Error Pages
Textpattern doesn’t (need to) handle any error besides 404. In any Apache environment I’ve stumbled across these past years, ErrorDocument XXX /foo.bar
worked for 403 or 500 stati, so we’d be better off if you could provide a little more information. Apache’s error_log or access_log might serve as a starting point.
Possibly related: FAQ.
Offline
Re: Custom Error Pages
I was under the impression that I could create an error page in Textpattern named error_xxx where xxx is the http error code (error_503, etc.) and that this page would be automagically displayed when apache generates the matching error. Is that not an accurate impression?
I have tried to create such pages, but they are not invoked as expected…
Offline
Re: Custom Error Pages
It’s a little bit more complex. Textpattern won’t even get a chance to handle all 500 errors, as some of those might be caused by an invalid line in .htaccess and therefore prematurely end all of Apache’s request processing.
Basically, Textpattern handles all of 404, plus status 500 when the root cause is located in some condition which Textpattern would be able to detect (currently, a failed file download is the only reason for a 500 response in Textpattern).
Anything else, especially 401 or 403, are up to Apache. Apache’s control flow might cause a transfer of the request back to Textpattern at some occasions (missing ErrorDocument being the most prominent), as indicated in the FAQ entry mentioned above.
Offline
Re: Custom Error Pages
Also, rvm_privileged lets handle error 503, and yes, then you can create a error_503 page template for customizing it.
Offline
Re: Custom Error Pages
^^ And so does rvm_maintenance: error_503.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Custom Error Pages
Mmm… I think I wanted to mean rvm_maintenance… but not sure… Yeah, definitely, I wanted to say rvm_maintenance.
Offline
Re: Custom Error Pages
Request granted. Say it!
Offline
Re: Custom Error Pages
OK, so in theory I should be able to create a new section (error) for error pages and use Apache’s ErrorDocument directive to send errors to those pages, right? But this is not working. For example, when I submit a form (POST) that contains data that mod-security rejects with a 501 error, the redirect does not occur. Instead, the form simply refuses to submit and refreshes itself (losing all form field data).
But if I change the ErrorDocument directive to use a static html page, it works…
Offline
Pages: 1