top of page
Search
  • weivanondircrisna

Mikrotik Hotspot Page



You can create a completely different set of servlet pages for each HotSpot server you have, specifying the directory in "html-override-directory" property of a HotSpot server profile /ip hotspot profile. The default servlet pages are copied in the directory "hotspot" directory right after you create server profile. This directory can be accessed by connecting to the router with an FTP client. You can copy this directory and modify the pages as you like using the information from this section of the manual. Note that it is suggested to edit the files manually, as automated HTML editing tools may corrupt the pages by removing variables or other vital parts. After you are finished with content modification you need to upload this modified content to some custom directory on hotspot router and point previously mentioned property "html-override-directory" value as path to this new custom HTML directory.


To insert variable in some place in HTML file, the $(var_name) syntax is used, where the "var_name" is the name of the variable (without quotes). This construction may be used in any HotSpot HTML file accessed as '/', '/login', '/status' or '/logout', as well as any text or HTML (.txt, .htm or .html) file stored on the HotSpot server (with the exception of traffic counters, which are available in status page only, and error, error-orig, chap-id, chap-challenge and popup variables, which are available in login page only). For example, to show a link to the login page, following construction can be used:




Mikrotik Hotspot Page



All of the Servlet HTML pages use variables to show user specific values. Variable names appear only in the HTML source of the servlet pages - they are automatically replaced with the respective values by the HotSpot Servlet. For most variables there is an example of their possible value included in brackets. All the described variables are valid in all servlet pages, but some of them just might be empty at the time they are accesses (for example, there is no uptime before a user has logged in).


$(if ) statements can be used in theses pages. Following content will be included, if value of will not be an empty string. It is an equivalent to $(if != "") It is possible to compare on equivalence as well: $(if == ) These statements have effect until $(elif ), $(else) or $(endif). In general case it looks like this:


To utilize this feature, create subdirectories in HotSpot HTML directory, and place those HTML files, which are different, in that subdirectory. For example, to translate everything in Latvian, subdirectory "lv" can be created with login.html, logout.html, status.html, alogin.html, radvert.html and errors.txt files, which are translated into Latvian. If the requested HTML page can not be found in the requested subdirectory, the corresponding HTML file from the main directory will be used. Then main login.html file would contain link to "/lv/login?dst=$(link-orig-esc)", which then displays Latvian version of login page: Latviski . And Latvian version would contain link to English version: English


After preferred directory has been selected (for example, "lv"), all links to local HotSpot pages will contain that path (for example, $(link-status) = " "). So, if all HotSpot pages reference links using "$(link-xxx)" variables, then no more changes are to be made - each client will stay within the selected directory all the time.


In case variables are to be used in link directly, then they must be escaped accordingly. For example, in login page, link will not work as intended, if username will be "123&456=1 2". In this case instead of $(user), its escaped version must be used: $(user-esc): link. Now the same username will be converted to "123%26456%3D1+2", which is the valid representation of "123&456=1 2" in URL. This trick may be used with any variables, not only with $(username).


There is a boolean parameter "erase-cookie" to the logout page, which may be either "on" or "true" to delete user cookie on logout (so that the user would not be automatically logged on when he/she opens a browser next time.


For example, there exists an ability to check the user agent (or browser), and will return any other content instead of the regular login page, if so desired. This can be used to disable automatic popups in phones, for example.


Apart from the obvious dynamic entries in the /ip hotspot submenu itself (like hosts and active users), some additional rules are added in the firewall tables when activating a HotSpot service. Unlike RouterOS version 2.8, there are relatively few firewall rules added in the firewall as the main job is made by the one-to-one NAT algorithm.


Any actions that should be done before HotSpot rules apply, should be put in the pre-hotspot chain. This chain is under full administrator control and does not contain any rules set by the system, hence the invalid jump rule (as the chain does not have any rules by default).


First in the hs-unauth chain is put everything that affects TCP protocol in the /ip hotspot walled-garden ip submenu (i.e., everything where either protocol is not set, or set to TCP). Here we are excluding www.mikrotik.com from being redirected to the login page.


All other HTTP requests are redirected to the Walled Garden proxy server which listens the 64874 port. If there is an allow entry in the /ip hotspot walled-garden menu for an HTTP request, it is being forwarded to the destination. Otherwise, the request will be automatically redirected to the HotSpot login servlet (port 64873).


HotSpot by default assumes that only these ports may be used for HTTP proxy requests. These two entries are used to "catch" client requests to unknown proxies (you can add more rules here for other ports). I.e., to make it possible for the clients with unknown proxy settings to work with the HotSpot system. This feature is called "Universal Proxy". If it is detected that a client is using some proxy server, the system will automatically mark that packets with the http hotspot mark to work around the unknown proxy problem, as we will see later on. Note that the port used (64874) is the same as for HTTP requests in the rule #9 (so both HTTP and HTTP proxy requests are processed by the same code).


Unlike NAT table where only TCP-protocol related Walled Garden entries were added, in the packet filter hs-unauth chain is added everything you have set in the /ip hotspot walled-garden ip menu. That is why although you have seen only one entry in the NAT table, there are two rules here.


How do I add a button to the main page in which the user can define the speed on the hotspot page and link it to mikrotik? I used the options tag and the select tag on the mikrotik hotspot page but it didn't work.


I'm trying to set a Default HTML Page to be opened after wifi connects automatically. Kinda like the Login page. I've tried writing a few javascript lines to make the redirect work but after redict, there is no content within my HTML.


When the page is displayed, the user is not logged in. A HTTP POST must be done with a username and password to login the user and access other sites. You can do this by adding a form to the external site or the login.html page to login the user with one click. Without the login any request will be redirected to the login.html page and/or your external site.


The version of RouterOS is not relevant to setup a MikroTik WiFi hotspot with Tanaza, as Tanaza replaces MikroTik firmware with its own firmware. Also Winbox is replaced by the Tanaza cloud platform, that can be reached at


In my previous article, I discussed how to configure MikroTik Hotspot using Winbox. Default Hotspot configuration provides a login page that we may find boring and not so perfect for our organization. So, in this article I will discuss how to customize Hotspot Login page according to our demand so easily.


Customizing MikroTik Hotspot login page is not so difficult task. Knowing some basic HTML, CSS and JavaScript, we can easily customize login page according to our demand. So, if we wish to customize login page, we need to do the following three steps.


When we setup Hotspot Server, it automatically creates necessary and basic files required to authenticate and authorize Hotspot users. These files including login page are kept in Files directory in MikroTik Router. So, at first we have to download the HTML login page from Files directory because there is no way to edit files keeping in MikroTik Router. The following steps will show how to download Hotspot login page from Files directory.


After downloading HTML login page, we will now edit the login file. So, open this file with any HTML editor. I personally use Notepad++ because it is free and easy to use. But if you have better editor, you can also use that.


Keeping the above restrictions in mind we are now free to customize the login page as our wish. I have rearranged the login page and applied some designs on it in my LAB Hotspot Server. The entire HTML, CSS and JavaScript code is given below for your reference.


The above code is written for a simple login page but it includes all required HTML, CSS and JavaScript code as example. So, if you have HTML, CSS and JavaScript experience, you can easily extend your login page functionality.


Note: if you have any image in login page, the image must upload in hotspot/img directory and add the image source as /img/logo.png where logo.png is an image file that representing company logo.


How to customize MikroTik Hotspot login page with HTML, CSS and JavaScript has been discussed in this article. I hope you will now be able to customize MikroTik Hotspot login page so easily. However, if you face any confusion to customize Hotspot login page with HTML, CSS and JavaScript code, feel free to discuss in comment or contact me from Contact page. I will try my best to stay with you.


Mikhmon voucher generator has a option of Username = Password So I want to make the hotspot login page with username field only, Password field should be hidden and filled automatically, as we know Username and Password are same. 2ff7e9595c


27 views0 comments

Recent Posts

See All
bottom of page