Forum

ErrorHandler = cgi script not working

Jason
2 June 2016, 00:38
Before upgrading to 10.1, The 9.4 version with working setting below:

ErrorHandler = 403:/cgi-bin/redirect.cgi

That setting along with other settings (i.e. Alias) worked fine all the time
until upgraded to 10.1 version, then stopped working.

What cause this stop working?

Thanks,

Jason
Hugo Leisink
2 June 2016, 09:27
Please explain 'stopped working'. The ErrorHandler option hasn't changed since v9.4 and some quick testing shows that it still works as intended.
Jason
3 June 2016, 19:37
Ok, I will explain what works and not working:

Without AccessList = deny homeip

I tested full url with redirect script (http://www.mydomain.com/cgi-bin/redirect.cgi). That script worked fine and able to redirect automatically. No empty page.

With AccessList = deny homeip

Tested and unable to automatically redirect. Just empty page showed up.

Also, tested full url with redirect script and empty page still showed up.


Here's the simple CGI equivalent of a HTML redirect page:
#!/usr/local/bin/perl

print "Location: http://www.google.com\n\n";


I typed: perl /var/www/mydomain/cgi-bin/redirect.cgi

It showed:

Location: http://www.google.com


Current perl version: 5.24

Thanks,

Jason
4 June 2016, 12:09
With 'AccessList = deny myip' enabled:

# curl -i www.mydomain.com
HTTP/1.1 403 Forbidden
Date: Sat, 04 Jun 2016 10:06:34 GMT
Connection: keep-alive
Transfer-Encoding: chunked
Location: http://www.google.com

#

Still empty page - did not redirect automatically.
Hugo Leisink
4 June 2016, 14:47
A redirect only works for a 3xx status code. A 403 will not work. Try adding the following line to your script:
print "Status: 301";
This topic has been closed.