开发者

Nginx: Location header sent by PHP redirects withoung changing domain

I'm having a strange problem here and can't figure the cause. I have a php-script on an nginx server which triggers a redirect to a different (sub)domain on the same server:

For instance: foo.domain.com/redirect.php header("Status:301"); header("location:http://www.domain.com/new_url/");

The result is that I'm getting redirected to: foo.domain.com/new_url

The domain doesn't change at all although my response headers look开发者_运维问答 fine .

Any ideas?


Ok, I finally found the cause for my troubles. Neither Nginx, nor PHP caused the issues. My webservers are behind a loadbalancer running with Pound.

Pound has a feature to rewrite domains inside header redirects (enabled by default). We now turned this feature off and all redirects finally work as expected!


Check your containing your site in an iframe,

Some hosts can do this if its free hosting, all so some domains setup allows the site to be contained in an iframe witch would cause the properly your describing

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜