2013-04-10 88 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流量的內容您的規則過濾器的