POST request interception

POST request interception

am 11.04.2008 20:12:38 von patpro

Hello,

I've setup an antispam for my blog, so that presumed spammers can only
GET/HEAD, but POST is denied.
I'm serving a special 403 as a result of a denied POST request, and I
would like to retrieve and log the content of this POST. Unfortunately,
my 403.php file won't see any content in $_POST.

So if I understand correctly, the POST request is not forwarded to the
final document:

spammer request : POST some data to /some/page.php
apache : denies POST and serves 403.php

Is there any way to intercept POST request content when POST is denied ?

thanks,

patpro

--
A vendre : KVM IP 16 ports APC
http://patpro.net/blog/index.php/2008/01/12/133

Re: POST request interception

am 12.04.2008 12:56:02 von unknown

Post removed (X-No-Archive: yes)

Re: POST request interception

am 12.04.2008 14:22:32 von patpro

In article ,
Davide Bianchi wrote:

> On 2008-04-11, patpro ~ patrick proniewski
> wrote:
> > spammer request : POST some data to /some/page.php
> > apache : denies POST and serves 403.php
>
> I think that Apache doesn't deny anything, and the deny/allow process is
> done in your /some/page.php, so do the interception and loggin there.

Currently, I'm using :

ErrorDocument 403 /403_post.php

Deny from env=GoAway


so Apache does deny POST requests from supposed spammers. I don't really
want to change this apache configuration based antispam by a full php
interception on every POST on the server.

patpro

--
A vendre : KVM IP 16 ports APC
http://patpro.net/blog/index.php/2008/01/12/133

Re: POST request interception

am 14.04.2008 13:55:19 von patpro

In article ,
patpro ~ patrick proniewski wrote:

> In article ,
> Davide Bianchi wrote:
>
> > On 2008-04-11, patpro ~ patrick proniewski
> > wrote:
> > > spammer request : POST some data to /some/page.php
> > > apache : denies POST and serves 403.php
> >
> > I think that Apache doesn't deny anything, and the deny/allow process is
> > done in your /some/page.php, so do the interception and loggin there.
>
> Currently, I'm using :
>
> ErrorDocument 403 /403_post.php
>
> Deny from env=GoAway
>

>
> so Apache does deny POST requests from supposed spammers. I don't really
> want to change this apache configuration based antispam by a full php
> interception on every POST on the server.


I've changed the vhost config, so that I don't use LimitExcept, and do
no longuer reply with a 403 error code.
Now I use this :

RewriteEngine ON
RewriteCond %{ENV:GoAway} 1
RewriteCond %{REQUEST_METHOD} POST
RewriteRule (.*) /403_post.php

It's not good because it gives a code 200 instead of a code 403, but
it's good because it allows me to record the POST request.

patpro

--
A vendre ! http://www.patpro.net/blog/index.php/2008/01/12/133

Re: POST request interception

am 14.04.2008 18:03:29 von phantom

"patpro ~ Patrick Proniewski" wrote in message
news:patpro-EA0A87.13551914042008@localhost...
> In article ,
> patpro ~ patrick proniewski wrote:
>
>> In article ,
>> Davide Bianchi wrote:
>>
>> > On 2008-04-11, patpro ~ patrick proniewski
>> >
>> > wrote:
>> > > spammer request : POST some data to /some/page.php
>> > > apache : denies POST and serves 403.php
>> >
>> > I think that Apache doesn't deny anything, and the deny/allow process
>> > is
>> > done in your /some/page.php, so do the interception and loggin there.
>>
>> Currently, I'm using :
>>
>> ErrorDocument 403 /403_post.php
>>
>> Deny from env=GoAway
>>

>>
>> so Apache does deny POST requests from supposed spammers. I don't really
>> want to change this apache configuration based antispam by a full php
>> interception on every POST on the server.
>
>
> I've changed the vhost config, so that I don't use LimitExcept, and do
> no longuer reply with a 403 error code.
> Now I use this :
>
> RewriteEngine ON
> RewriteCond %{ENV:GoAway} 1
> RewriteCond %{REQUEST_METHOD} POST
> RewriteRule (.*) /403_post.php
>
> It's not good because it gives a code 200 instead of a code 403, but
> it's good because it allows me to record the POST request.
>

Your php script can send the 403 header:
header('HTTP/1.1 403 Forbidden');

Re: POST request interception

am 14.04.2008 18:45:40 von patpro

In article ,
"phantom" wrote:

> > I've changed the vhost config, so that I don't use LimitExcept, and do
> > no longuer reply with a 403 error code.
> > Now I use this :
> >
> > RewriteEngine ON
> > RewriteCond %{ENV:GoAway} 1
> > RewriteCond %{REQUEST_METHOD} POST
> > RewriteRule (.*) /403_post.php
> >
> > It's not good because it gives a code 200 instead of a code 403, but
> > it's good because it allows me to record the POST request.
> >
>
> Your php script can send the 403 header:
> header('HTTP/1.1 403 Forbidden');

yep, I will try this, thanks.

BTW, I've tried:

RewriteRule (.*) /403_post.php [F]

but it wont work.

patpro

--
A vendre : KVM IP 16 ports APC
http://patpro.net/blog/index.php/2008/01/12/133

Re: POST request interception

am 14.04.2008 22:31:47 von patpro

In article ,
"phantom" wrote:

> Your php script can send the 403 header:
> header('HTTP/1.1 403 Forbidden');

Well, I've tried this, but unfortunately, it won't make Apache log a
403. The client gets the 403, but Apache logs a 200.

patpro

--
A vendre : KVM IP 16 ports APC
http://patpro.net/blog/index.php/2008/01/12/133