Custom SquidGuard Error Pages?
-
Hi there,
there must be a problem when ypu pasted in the CODE. The Code I posted first is NOT the hole file, is is just a part of it. Recheck this and leave your comment here.
-
Hi foresthus,
I did not back up the original sgerror.php file (my bad).
All I have in the file now is the code you posted.
Would you be able to share your whole sgerror.php file for me to try?
Thanks -
I don't think it is incomplete code. I have tried other sgerror.php files on the forum and they all give me similar results. It seems like the commands in the file are not being executed and instead just printed on screen eg: function get_error_page($er_code_id, $err_msg='')
This just comes up as is on the screen when accessing a restricted page.This is the file I am using at the moment:
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # IE displayed self-page, if them size > 1024 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function get_error_page($er_code_id, $err_msg='') { global $err_code; global $cl; global $g; global $config; $str = Array(); header("HTTP/1.1 " . $err_code[$er_code_id]); $str[] = ''; $str[] = ''; $str[] = '<title>Access Denied by EoN Gateway</title>'; $str[] = ''; /* if ($config['installedpackages']['squidguarddefault']['config'][0]['deniedmessage']) { $str[] = " ### {$config['installedpackages']['squidguarddefault']['config'][0]['deniedmessage']}: {$err_code[$er_code_id]} "; } else { $str[] = " ### Request denied by {$g['product_name']} proxy: {$err_code[$er_code_id]} "; } */ $str[] = ''; $str[] = ''; if ($cl['n']) $str[] = "Client Name: {$cl['n']} | "; if ($cl['a']) $str[] = "IP: {$cl['a']} | "; if ($cl['i']) $str[] = "User: {$cl['i']} | "; if ($cl['s']) $str[] = "Group: {$cl['s']} | "; if ($cl['t']) $str[] = "Blocked Category: {$cl['t']} "; $str[] = ''; $str[] = 'Request Denied by Gateway!'; $str[] = ''; if ($cl['u']) $str[] = " **URL:** {$cl['u']} "; $str[] = ' Access to above site is restricted during office hours (Sunday to Thursday, 9.30am - 6.30pm / Saturday, 10.30am - 3.00pm). Please try again outside of these hours, or if you need urgent access, discuss with the [System Administrator](mailto:user@domain.com). '; $str[] = '  '; $str[] = 'Web Filtering by [**PfSense**](https://pfsense.org) and [**SquidGuard**](http://squidguard.org) | Copyrights © 2014\. Company Name'; $str[] = ""; $str[] = ""; return implode("\n", $str); }
And it looks like this;

 -
I don't think it is incomplete code.
Of course it's incomplete code. You don't even have the PHP declaration at the top. That's why it doesn't work. Attached you find a proper sgerror.php.
-
Thanks. I understand now. I have it working.
-
Hi.
You could also uninstall the addon SquidGuard and then reinstall it again. You should get the original file.
It is always better to make a backup copy. ;)
-
It is always better to make a backup copy.
In this case it's mandatory. Every upgrade will overwrite that file with the default copy.
-
Hi,
So im running pfSense 2.2.2 with squid3, squidGuard, and pfBlockerNG. I use pfBlockerNG to block https (IP) and use squidGuard to block http. Everything is working well. But I would like to have a custom block page. Currently it shows the default blocked page (see picture below). I tried ext url redirect and put in the redirect info www.google.com just to see if redirection is working. Which is not working.Thank you
My error pages are showing the client IP and hostname as part of the url like yours is. I've gone through the code as much as I can and can't find anything that would help me to understand why this is happening.
-
I have the same problem since I updated from 2.1.5.
It worked till 2.1.5 and at some point something was broken and now is not properly redirect when an url is blocked, it ad after the redirect to destination address ( in my case: https://duckduckgo.com ) this string:https://duckduckgo.com**%20[HOST IP blocked]/[HOST FQDN blocked]%20-%20GET**
-
Hi,
the code still works fine on pfsense 2.2.4 with squid3 and squidguard. You need the image and the file sgerror_forum.txt. You need to change the name to sgerror.php. Copy it to your pfsense with for example winscp into the folder /usr/local/www/
Thats all.
-
Hi,
the code still works fine on pfsense 2.2.4 with squid3 and squidguard. You need the image and the file sgerror_forum.txt. You need to change the name to sgerror.php. Copy it to your pfsense with for example winscp into the folder /usr/local/www/
Thats all.
It's not working for me. Even after using your sgerror.php and copying it to/usr/local/www folder. When I get my deny page I am seeing this as the blocked url: URL: http://www.playboy.com/10.0.0.10/desktop-fj4n784.syndicate.com-GET
It's got to be some setting in squidguard or something…
-
I'm almost the same problem. The squidguard does not display the custom sgerror.php, only displays a white screen and 400 - Bad Request.
Someone found a solution?
Thanks, -
Hello,
of course you must set for the rule you want to have the errorpage in squidguard. I thought that this was clear.
Look at the image.
-
Hello,
of course you must set for the rule you want to have the errorpage in squidguard. I thought that this was clear.
Look at the image.
Yes, this option is already selected.
-
Well, I tried everything. All settings and nothing. I took an internet outage here in my region and formatted the server and installed all of ZERO. I not returned or backup.
So far all normal, squidguard blocking, but showing the screen "403 Forbidden" and not the "400 Bad Request".Thank you to those who helped in any way :)
-
Hi there,
I guess my solution is not working anymore, because basically the content of the file changed completely. I will look if can post a new solution here.
cu.