Web Proxy Redirect to html file on router

I have set up a web proxy that blocks specific websites. I would like to redirect the default “Forbidden” to an html file stored on the router. Is this possible?

I was able to redirect to an external site, but could not get the path right to get to a file named “test.html” that I ftp’d up to the directory where my backup files are kept.

Any help would be greatly appreciated.

hi, It’s possible.

YOu have to put your html file in the router (like the path of login.html) and then redirect the error to routerIP/lalalala : P!

Thanks for the quick reply.

I tried that before, and it cant find the page.

Do I have the file in the right directory? If I just go to files in winbox, I can see the file there.

If I go to 192.168.3.2/test.html, I get page can not be displayed.

What is the path to the login.html, I dont see that file. How do I get to it?

I am not using a hotspot.

hi,


you need to make it with a hotspot. This enables the “html server” to show the custom file..

I don’t know if it’s possible to make without hotspot. I think that no.

I have dropped a test.html file into the hotspot directory.

I can see the login page at 192.168.2.1/hotspot/login.html.

If I try to view the test file @ 192.168.2.1/hotspot/test.html, I just get page can not be found.

Why will it render one file, but not the other.

hi,

it works, but I think is without /hotspot.

There is also a possibility to edit default web-proxy error page and not to use redirect

What's new in 3.28:
*) web proxy - allow to edit error page;

Aps, ok.

I don’t tryed this yet.. sorry : P

Where can I find “Whats new in 3.28”? Does it have documentation on how to edit the error page?

this is from the changelog, changelog is on the download page. there are no instructions yet

http://www.mikrotik.com/download/CHANGELOG_3

Just download webproxy/error.html file form webproxy folder located on your router. Edit it as a standart HTML file. And upload it back where it was.

thank you

Worth pointing out that that file doesn’t appear automatically (at least on any system I’ve tried it on) and I had to click on ‘Reset HTML’ in the web proxy settings window in Winbox.

I notice that the page http://wiki.mikrotik.com/wiki/Manual:IP/Proxy covers a lot of the settings, but not all - why does “cache-hit-dscp”, for example, not have a description?

That page also does not cover the content of the file webproxy/error.html. On my system it is created with the following content:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>ERROR: $(status)</title></head>
<body><h2>ERROR: $(status)</h2>
<hr noshade size="1px"/>
$(if error)
<p>While trying to retrieve the URL <a href="$(url)">$(url)</a>:</p>
<ul><li><strong>$(error)</strong></li></ul>
$(endif)
<p>Your cache administrator is <a href="mailto:$(admin)">$(admin)</a>.
$(signature)
</body></html>

and I have the following questions:

  1. Why is there a section in an ‘if error’ clause? Is there any condition where the error.html file which says “ERROR” in it isn’t an error and this clause does not apply?
  2. What are the possible options for ‘$(status)’ - it would be nice to edit that page to have some explanation for the user.
  3. Where is ‘$(signature)’ defined? I would like to be able to remove ‘Mikrotik HttpProxy’ from the message to make it more personalised for the end user.