NYCPHP Meetup

NYPHP.org

[nycphp-talk] Switching Forth and Back Between HTTP and HTTPS

John Campbell jcampbell1 at gmail.com
Sun Aug 10 21:21:37 EDT 2008


On 8/10/08, Michael B Allen <ioplex at gmail.com> wrote:
>  if ($scheme) {
>     header('Location: ' . rebuild_url_with_new_scheme($scheme));
>     exit();
>  }


The code above won't always work because if the request is a post
request, the post data will not get passed to the https url.  I think
the http spec says it is supposed to, but in reality the POST data is
not sent to the redirected location.  Maybe the thing to do is throw a
404 if post data is sent to a script that requires ssl.

I would also use a 301 redirect in this case.

-John C



More information about the talk mailing list