2013-04-10 89 views
-1

按照以下规则重定向,php不能将redirect创建为另一个文件。当它到达header("Content-type: video/x-flv"); header("Location:" . $VIDEO); 或者我的php脚本可能是get_headers();时,它就冻结了。允许使用iptables

我的iptables:

iptables -L 
Chain INPUT (policy ACCEPT) 
target  prot opt source    destination   
ACCEPT  tcp -- anywhere    anywhere   tcp dpt:22151 
ACCEPT  tcp -- anywhere    anywhere   tcp dpt:http 
ACCEPT  all -- anywhere    anywhere    
ACCEPT  tcp -- anywhere    anywhere   tcp dpt:webcache 
ACCEPT  tcp -- anywhere    anywhere   tcp spt:webcache 
ACCEPT  tcp -- anywhere    anywhere   tcp spt:http 
DROP  all -- anywhere    anywhere    

Chain FORWARD (policy ACCEPT) 
target  prot opt source    destination   

Chain OUTPUT (policy ACCEPT) 
target  prot opt source    destination  

我所尽快尝试

iptables -A INPUT -p ICMP --icmp-type 8 -j ACCEPT 

我删除DROP all -- anywhere anywhere一切工作正常。

+0

无参见here,所以我不认为是什么问题,你认为它是。 – Barmar 2013-04-10 20:53:32

+0

这并不重要,但在重定向时不需要发送“Content-type”标头。客户端会忽略您发送的内容,而是转到“位置”标题中的页面。你是说这些iptables规则阻止客户端收到'Location'头文件吗? – Barmar 2013-04-10 20:57:23

+0

@Barmar是的。或者可以在'get_headers();'停下来 – rabotalius 2013-04-10 21:00:56

回答

1

当您使用get_headers()时,您的脚本会建立一个传出的HTTP连接。您需要允许回复流量,允许建立会话。

sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT 

更多信息基于HTTP流量的内容您的规则过滤器的