Forum Moderators: phranque

Message Too Old, No Replies

How to preserve post data in a rewriterule

         

GdlNgc

10:07 am on Jul 19, 2005 (gmt 0)

10+ Year Member



Hi, in our network we want to send some data using a POST method by RewriteRule in Apache config. In particular, we used the following rules:

RewriteRule ^/abc/(.*) [zzz.kk.yy:54000...] [R=301,L,NE]

also, we tried this:

RewriteCond METHOD POST
RewriteRule ^/abc/(.*) [zzz.kk.yy:54000...] [P,L]

But none of these send data.

Can anyone help us?

Thanks in advance
Camp

bird

12:36 pm on Jul 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For security reasons, browsers are supposed to continue with a GET after a redirect.

You'll need a different approache to solve your underlying problem.

GdlNgc

1:42 pm on Jul 19, 2005 (gmt 0)

10+ Year Member



Bird, thank you for your reply.

In our architecture, we want transfer data between a

[serverA.some...] domain/some URI

to

[serverB.same...] domain/same URI

For better network efficiency and more security data transfer we've preferred use http POST method.

Is the http GET method the only way to resolve the issue encountered?

jdMorgan

1:24 am on Jul 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, and that can't work, because you are taking data posted to a secure sever, and trying to redirect it to an unsecure server. Since this is patently unsafe to do, it is not supported.

You can either move the page that POSTs the form to the unsecure server, or you can POST from the page on the secure server to a script on the secure server, and then do the redirect after the script runs. But you cannot POST data across the secure-to-insecure boundary because it's, well, not secure. It's a hack attempt at worst or a violation of user trust at best -- a really good way to lose business.

Even if your intent is beyond reproach, anybody with a packet sniffer could grab that POST data -- data submitted by a user who believed he/she was POSTing to a secure site.

A fine point: If the target server is inside your private network, you could possibly proxy the POST data through the secure server over to the unsecure server. Assuming you have implemented basic physical security and data safeguards on that server, that might be an acceptable solution. See Apache mod_proxy.

Jim