This is a discussion on Re: how to send 405 within the Linux Web Servers forums, part of the Web Server and Related Forums category; Brian wrote: > I have a form mail script (TFmail from NMS) that I'm testing on Apache > 2....
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Brian wrote:
> I have a form mail script (TFmail from NMS) that I'm testing on Apache > 2.0/WinXP; it will eventually go on an Apache 1.3/Linux server. The > script works fine when form data is posted to it, but it throws a script > error if any other method is used. This is a (minor) problem if someone > bookmarks the "message sent" success page generated by the script, so I > wanted to prevent GET access to the script. Is there any way to generate > a 405 http error via .htaccess? > > A Google search of the web and this group showed only hits for trying to > avoid 405 errors on POST requests. <LimitExcept POST> Order allow,deny Deny from all </LimitExcept> Or just have your cgi script check the REQUEST_METHOD and error-out if it isn't POST. Joshua. |
|
|||
|
Joshua Slive wrote:
> Brian wrote: > >> I have a form mail script (TFmail from NMS) >> it throws a script error if any other method is used. >> I wanted to prevent GET access to the script. Is there any way to >> generate a 405 http error via .htaccess? > <LimitExcept POST> > Order allow,deny > Deny from all > </LimitExcept> Thanks for the idea. I tried this, but Apache returns 403, not 405. Not exactly a mission critical thing, I know. But 403 is returned for other resources, whereas 405 would be for just this situation, so the error message could be more specific and more helpful. > Or just have your cgi script check the REQUEST_METHOD and error-out > if it isn't POST. That may be the only way to go. It errors out on !POST, but the script's error message is not very helpful. I was hoping to do better via Apache, but there does not appear to be a way to generate 405 and serve up a document via ErrorMessage. Thanks for your time. -- Brian (remove ".invalid" to email me) http://www.tsmchughs.com/ |