You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by CS Imamu <cs...@gmail.com> on 2007/12/12 19:32:17 UTC

[users@httpd] Why does a form POST generate a redirect (302) with GET?

Hello,

I've developed a small Java web application that is running in an
environment using Apache Web server sitting in front of IBM Websphere.
We get the following behavior that we've traced to the Web server (so
it never even gets to Websphere):

The application allows the user to upload files to the server. I am
using Apache's file upload library, but that's not the issue. The
issue is described by the client in the following words:

"When we try to upload a large spreadsheet, we are getting a couple of
different errors but we are unable to determine the cause at this
point.

The Web server appears to receive the POST request from the browser
and then sends a redirect (302) response to the browser. We don't know
why this is happening. This is causing the browser to either display
an error or to send the post request again as a GET request. The GET
request fails because the browser is putting the form data in the URI,
making it too big."

The form in question is a simple file upload form. It is structured
using post and multi-part. The symptom of the error is that a huge URL
appears in the browser after hitting submit, and the explanation is as
given above, i.e: the form is submitted using POST, Apache responds
with a 302, and then the browser resends the request using GET but now
the request URI is huge...

The application fails on the server because the URI is too long when
the browser sends it. Keep in mind, as the explanation above
indicates, my application is not generating this huge URL: I send the
form parameter using POST, and somehow things go wrong...

On Sun's Application Server which is not using Apache Web server, all
is well.The file is correctly and quiely uploaded...

Any ideas?

thanks very much in advance.

- Ahmed

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Why does a form POST generate a redirect (302) with GET?

Posted by Nick Kew <ni...@webthing.com>.
On Wed, 12 Dec 2007 21:32:17 +0300
"CS Imamu" <cs...@gmail.com> wrote:

> The Web server appears to receive the POST request from the browser
> and then sends a redirect (302) response to the browser.

The server won't do that unprompted.  Either your application or
your configuration is sending a redirect.

>  We don't know
> why this is happening. This is causing the browser to either display
> an error

That doesn't make sense.  302 isn't an error.

>   or to send the post request again as a GET request. The GET
> request fails because the browser is putting the form data in the URI,
> making it too big."

That's incredibly broken browser behaviour (unless your application
is sending the whole caboodle in the redirect).  I don't believe any
"normal" browser is that broken.

I infer that your problem description is garbled.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org