これは正常に機能します (別のドメインにリダイレクトします):
#! /usr/bin/perl
print "Location:http://AnyDomainBesidesMyOwn.com/\n\n";
close(STDOUT); close(STDIN); close(STDERR);
[some long process]
しかし、次の方法ではブラウザが停止し、長いプロセスが終了するまでリダイレクトを拒否します。上記からの唯一の変更点は、スクリプトの実行元と同じドメインの別のページにリダイレクトしていることです。
#! /usr/bin/perl
print "Location:http://MyOwnDomain.com/\n\n";
close(STDOUT); close(STDIN); close(STDERR);
[some long process]
新しいプロセスをフォークすることでこれを機能させることができることは知っていますが、もっと簡単な方法が必要です...そうですか?
更新: Firefox のライブ ヘッダーから取得した出力は次のとおりです。
http://example.com/test3.cgi
GET /test3.cgi HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:18.0) Gecko/20100101 Firefox/18.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
HTTP/1.1 302 Found
Date: Sun, 27 Jan 2013 23:31:49 GMT
Server: Apache
Location: http://example.com/
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 187
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
そして、リダイレクトするように設計した後:
http: //example.com/ [Have to include the space b/c stackoverflow limits the number of links I can include in a post]
GET / HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:18.0) Gecko/20100101 Firefox/18.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
HTTP/1.1 200 OK
Date: Sun, 27 Jan 2013 23:31:54 GMT
Server: Apache
Accept-Ranges: bytes
X-Mod-Pagespeed: 0.10.21.2-1381 [Same problem even on a domain w/o pagespeed installed]
Vary: Accept-Encoding
Content-Encoding: gzip
MS-Author-Via: DAV
Cache-Control: max-age=0, no-cache
Content-Length: 12189
Keep-Alive: timeout=2, max=99
Connection: Keep-Alive
Content-Type: text/html