Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to set some http headers while http-redirect(302 or 307)?

Is it possible to set some http headers while http-redirect(302 or 307)?

<?
 header("some-header: xxx");
 header("Location: http://other.domain.com/foo.php",TRUE,307);

?>
like image 764
4esn0k Avatar asked Nov 26 '22 12:11

4esn0k


1 Answers

You can basically set whatever http headers you want either as the server or the client.

If you are indicating a redirect you should supply the Location header as your example suggests. You should also ensure that your response headers refer to that response rather than the resource that the client is being redirected to. i.e. your headers here could include Content-Length: 0, omit the Content-Type header and so on.

Not sure if this is what you're after - this question could do with a bit more detail.

like image 127
Richard J Avatar answered Dec 05 '22 20:12

Richard J