Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Is it possible to redirect a POST?

Posted on 1999-07-23
Medium Priority
Last Modified: 2013-12-25
I know that you can redirect a user via cgi by sending the header:


Is it possible to redirect like this with a post operation?
In other words, the above is just a plain get, with stuff on the query string, what about if someone executed a POST into my cgi script, but I want a different cgi script on a different server to handle the post. Can you redirect that post to the other server?
Question by:taotree
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Author Comment

ID: 1835181
Adjusted points to 100

Accepted Solution

jhurst earned 200 total points
ID: 1835182
YES  -however, the LOCATION header does not allow you to send posted information.  But the re-direct will work when the form is posted.

Probably the way to do what you want is to have a script that reads the posted paramneters and then converts them to the ?.... as expected in a GET before the re-direct.  The down-sides are:
1) there is usually a limit to the lenngth of the QUERY_STRING that the server will accept in the GET
2) The values of the parameters will become visible in the location bar.

LVL 84

Expert Comment

ID: 1835183
Or you might send a POST request from your CGI program to the other server.
Give Your Engineering Team a Productivity Boost

Learn why container technology is so powerful and how it can provide your team with productivity gains and other benefits.


Expert Comment

ID: 1835184
Something to take into consideration with a redirect: most browsers will pop up a window telling the user that the POST request is being redirected. This is a good thing, but it might not what you want.

Floris 'i want to change my nick' van Gog

Author Comment

ID: 1835185
Well, I'm basically taking these comments as a "no" to my question. I already knew most of what was said--I'm going to implement with the POST to GET routing and just hope no one exceeds the query string limit.

I guess my next question is why doesn't the HTTP spec let you do this? Why allow redirect of a get but not a post (with all data that is)?


Expert Comment

ID: 1835186
The POST data is not contained within the header, GET data is. That might be why :)


Author Comment

ID: 1835187
Doesn't seem like it would be that hard to have the Location header act in such a way that it tells the client, "okay redo your entire request to this other url". The client would then resend it's request along with all post data.

Oh, well. We'll live. I was considering the "server make post request then return the web page myself", but that could add up to a lot of extra bandwidth and might get expensive.

Here's another question, though, if I did that, is there anyway to tell the browser to change the URL in the location bar? Because if I return the web page--all the relative links will not work.

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at (http://www.experts-ex…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question