Community discussions

MikroTik App
 
braind
just joined
Topic Author
Posts: 3
Joined: Thu Nov 12, 2015 11:10 pm

Hotspot captive portal prevent automatic close on redirect after login

Sat Nov 14, 2015 12:54 am

Hello.

Have got the hotspot on mikrotik routerboard, that redirects to the external page after login. On ios it works well, user scrolls the captive portal page, authenticates and gets redirected to the external page. On android got an issue - after opening the notification of wifi session, android opens the captive portal and after authentication, while gets the redirection, popup browser closes automatic. Need to prevent from automatic close and show redirected page after the success authentication.

Used to try to add deny rules to wallet garden and firewall of clients3.google.com, but no success.

What kind of solution could be applied for this type of issue? Did somebody tried to use ajax instead of redirection?

Thank you for your attention.
 
mariocelija
just joined
Posts: 4
Joined: Mon Dec 14, 2015 4:55 pm

Re: Hotspot captive portal prevent automatic close on redirect after login

Mon Dec 14, 2015 5:19 pm

Hi I have the same problem.

I've setup hotspot on RouterBoard 2011 and edited login.html page so it logs in the trial user and redirects to an external web page. I've tested it on several devices running different types of OS; and on some devices the redirect works, on others it doesn't. As follows:

Notebook PC running Windows 7 and Windows 10 – I connect to the network, open a browser, get the login page and everything works fine
HTC One M8 mini running Adnroid 4.4.2 – after i connect to the network i get the notification I need to login, I click on the notification, get the login page and everything works fine
Lenovo P70 running Android 4.4.2 – after i connect to the network i get the notification I need to login, I click on the notification, get the login page and everything works fine
Samsung Galaxy S5 running Android 5.0 – login page pops out automaticly after i connect to the network; and everything works fine

Notebook PC running Linux Ubuntu 14.04.3 - login page pops out automaticly after i connect to the network; and after i click the login link the browser shows a blank page
Samsung Galaxy S6 Edge running Android 5.1.1 – login page pops out automaticly after i connect to the network; and after i click the login link the browser closes automaticly
Sony Xperia Z3 Compact running Android 5.1.1 – after i connect to the network i get the notification I need to login, I click on the notification, get the login page and after i click the login link the browser closes automaticly
Nokia Lumia 735 running Windows Phone 8 – login page pops out automaticly after i connect to the network; and after i click the login link the browser closes automaticly
Lenovo P70 running Android 5.1 - after i connect to the network i get the notification I need to login, I click on the notification, get the login page and after i click the login link I get an error (just an red lock icon)

The problem is the same regardless of the web page I redirect to. Could there be a problem with hotspot configuration or with login.html page?
 
mariocelija
just joined
Posts: 4
Joined: Mon Dec 14, 2015 4:55 pm

Re: Hotspot captive portal prevent automatic close on redirect after login

Mon Dec 14, 2015 5:31 pm

Hi,

I've setup hotspot on RouterBoard 2011 and edited login.html page so it logs in the trial user and redirects to an external web page. I've tested it on several devices running different types of OS; and on some devices the redirect works, on others it doesn't. As follows:

Notebook PC running Windows 7 and Windows 10 – I connect to the network, open a browser, get the login page and everything works fine
HTC One M8 mini running Adnroid 4.4.2 – after i connect to the network i get the notification I need to login, I click on the notification, get the login page and everything works fine
Lenovo P70 running Android 4.4.2 – after i connect to the network i get the notification I need to login, I click on the notification, get the login page and everything works fine
Samsung Galaxy S5 running Android 5.0 – login page pops out automaticly after i connect to the network; and everything works fine

Notebook PC running Linux Ubuntu 14.04.3 - login page pops out automaticly after i connect to the network; and after i click the login link the browser shows a blank page
Samsung Galaxy S6 Edge running Android 5.1.1 – login page pops out automaticly after i connect to the network; and after i click the login link the browser closes automaticly
Sony Xperia Z3 Compact running Android 5.1.1 – after i connect to the network i get the notification I need to login, I click on the notification, get the login page and after i click the login link the browser closes automaticly
Nokia Lumia 735 running Windows Phone 8 – login page pops out automaticly after i connect to the network; and after i click the login link the browser closes automaticly
Lenovo P70 running Android 5.1 - after i connect to the network i get the notification I need to login, I click on the notification, get the login page and after i click the login link I get an error (just an red lock icon)

The problem is the same regardless of the web page I redirect to. Could there be a problem with hotspot configuration or with login.html page?
 
draguzet
Frequent Visitor
Frequent Visitor
Posts: 74
Joined: Fri Jul 01, 2011 10:28 am

Re: Hotspot captive portal prevent automatic close on redirect after login

Mon Dec 14, 2015 5:32 pm

Same problem...any info about solution ?
 
mschut
just joined
Posts: 20
Joined: Sat Aug 18, 2007 10:05 am
Location: The Hague Netherlands
Contact:

Re: Hotspot captive portal prevent automatic close on redirect after login

Wed Jul 27, 2016 7:59 pm

Same problem here on late IOS and stock android 6 devices.
Anyone with a smart idea?
 
trace323
Frequent Visitor
Frequent Visitor
Posts: 53
Joined: Thu May 07, 2015 5:52 pm

Re: Hotspot captive portal prevent automatic close on redirect after login

Fri Jul 29, 2016 4:04 am

Same problem here on late IOS and stock android 6 devices.
Anyone with a smart idea?
Hello All.. I have the same issue. This is the not a Mikrotik issue. This is a OS Android issue. By default browser on the the Android device it will do that/ Don't ask why but there is NO fix at all for that.. Do this..
Connect to you're network. Once connected , open up google chrome on youre're Android device, see you're Terms of page. Once you do that, it will take you to your landing page correctly.
I was doing some testing myself as well today and it works fine on other browsers.. Try to make google chrome ur browser, or other browser besides the "DEFAULT" that comes with Android.
You will see your login page and get redirected to ur landing page.. ( home page ) or whatever you want to call it...
Thanks all.
 
santangelo
just joined
Posts: 3
Joined: Tue Aug 30, 2016 11:04 pm

Re: Hotspot captive portal prevent automatic close on redirect after login

Wed Oct 19, 2016 5:00 pm

Hi, we guess that we have found a solution. At least, we avoid captive portal login being automatically closed. For anyone that requires more information, please reach us in contacto@santangeloingenieria.com
 
User avatar
ionas
just joined
Posts: 11
Joined: Tue May 05, 2015 9:41 pm
Location: Nicosia
Contact:

Re: Hotspot captive portal prevent automatic close on redirect after login

Tue Dec 20, 2016 8:32 pm

Hi santangelo,

Mikrotik consultant here. I ve also sent you an email!

Could you please give us some directions or contact me regarding the solution of this problem.

I will take the time and post the whole solution here afterwards!

thx!
 
whittle
just joined
Posts: 8
Joined: Tue Nov 01, 2016 8:31 pm

Re: Hotspot captive portal prevent automatic close on redirect after login

Sun Jan 01, 2017 5:31 pm

Anyone already have a solution that they can say without asking for money?
 
ClaudioJunior10
just joined
Posts: 15
Joined: Mon Jan 23, 2017 2:38 pm

Re: Hotspot captive portal prevent automatic close on redirect after login

Thu Jan 26, 2017 4:42 am

Good night, I'd like your help, yes. Does my redirect open and then close on my phone? You have the solution
 
ClaudioJunior10
just joined
Posts: 15
Joined: Mon Jan 23, 2017 2:38 pm

Re: Hotspot captive portal prevent automatic close on redirect after login

Fri Jan 27, 2017 7:59 pm

Hello.

Have got the hotspot on mikrotik routerboard, that redirects to the external page after login. On ios it works well, user scrolls the captive portal page, authenticates and gets redirected to the external page. On android got an issue - after opening the notification of wifi session, android opens the captive portal and after authentication, while gets the redirection, popup browser closes automatic. Need to prevent from automatic close and show redirected page after the success authentication.

Used to try to add deny rules to wallet garden and firewall of clients3.google.com, but no success.

What kind of solution could be applied for this type of issue? Did somebody tried to use ajax instead of redirection?

Thank you for your attention.
Good afternoon got a solution? I have the same problem
 
Iron
just joined
Posts: 4
Joined: Wed Jan 19, 2011 11:24 am

Re: Hotspot captive portal prevent automatic close on redirect after login

Mon Oct 09, 2017 7:59 pm

Hello guys. I've found a partial solution. So i've made an investigation. When android phone connects to wi-fi he trying to access some google net and amazon net addresses (to tcp pot 5223 and so on). So i've sniffed that addresses and put in walled-garden white list. So now when phones connects he thinks that Internet is accessible and doesn't open hotspot login page automatically. :)
The minus of this scheme is that google pages are accessible without login. But for my environment it is not a problem. May be for someone this info will be useful.
 
reinerotto
Member
Member
Posts: 441
Joined: Thu Dec 04, 2008 2:35 am

Re: Hotspot captive portal prevent automatic close on redirect after login

Mon Oct 09, 2017 8:43 pm

You have the best solution, possible on mikrotik. However, very best solution can be done on open (openwrt/LEDE) hotspot systems.
I.g. it means, to filter (or to fake) the internet-connection probes by iOs, WP, Android.
Your issue is one more confirmation for my decision, to drop MT for hotspots with special (read: top of the line) requirements.
 
electravis
Member Candidate
Member Candidate
Posts: 259
Joined: Tue Jan 26, 2010 12:06 am

Re: Hotspot captive portal prevent automatic close on redirect after login

Tue Jun 19, 2018 12:50 am

So here is what I have done seems to work pretty well.

So after you login the user profile adds you to a firewall list which blocks the connectivy checker for 15 secs before removing the user from the list.

So this allows the redirect to happen to the post page because you are online but fools the captive portal and phone to think you are still not online and not close the captive portal. This seems to work at least 80% of the time as it is all a timing issue and also if google changes the chekecer url at somepoint you would then need to change it in the firewall rules.

Hope this helps..


IP firewall filter
chain=forward action=jump jump-target=hs-unauth protocol=tcp src-address-list=LoggedIn content=connectivitycheck.gstatic.com


IP hotspot user profile

name="default" session-timeout=2d idle-timeout=none status-autorefresh=5m shared-users=unlimited add-mac-cookie=yes mac-cookie-timeout=2d
address-list="" on-login=/ip firewall address-list add list=LoggedIn address=$address comment=$"mac-address"\r\n:delay 15s\r\n/ip firewall
address-list remove [find comment="$"mac-address""]\r\n transparent-proxy=no
 
David1234
Forum Guru
Forum Guru
Posts: 1293
Joined: Sun Sep 18, 2011 7:00 pm

Re: Hotspot captive portal prevent automatic close on redirect after login

Sun Aug 26, 2018 4:27 pm

can you explain what you did there?
I can't seem to understad the logic

I have the same problem -
I want to redirect my users to my page after login - but the captive portal is turn off after login
did you mange to "Fix" this problem ?

Thanks ,
 
AnupamPradhan
newbie
Posts: 35
Joined: Wed May 04, 2016 2:44 pm

Re: Hotspot captive portal prevent automatic close on redirect after login

Mon Aug 27, 2018 9:35 pm

In Android there is an option to check the background connectivity. Same as Windows.

In Windows if it cant reach the background link then it will show a small yellow triangle in the network icon in status bar.

For Android the link is
connectivitycheck.gstatic.com
And when it cant reach the link it will popup a sign in option in your mobile. Its all by design. And if you sign in through that pop up by clicking on it it will take you to the internal browser which is hardcoded in android . This is not the default Browser or any custom browser. So changing the default browser to Chrome will not help.

For me the simplest solution is to bypass the link by adding it to wallgarden. Hope it will work for you guys.
add action=accept disabled=no !dst-address !dst-address-list dst-host=connectivitycheck.gstatic.com
 
R1CH
Forum Veteran
Forum Veteran
Posts: 926
Joined: Sun Oct 01, 2006 11:44 pm

Re: Hotspot captive portal prevent automatic close on redirect after login

Wed Aug 29, 2018 3:40 pm

Be aware that by bypassing the connectivity check in this way there will be NO hotspot popup. Your users will have a very hard time triggering the captive portal redirect, as most sites are using HTTPS which means they will show scary security error messages instead of a redirect.

Think carefully about the appearance you want to give your users. Fast and easy access with automatic hotspot popup? Or leaving them to see lots of HTTPS errors and stumble around until they finally hit a HTTP link to trigger the redirect?
 
David1234
Forum Guru
Forum Guru
Posts: 1293
Joined: Sun Sep 18, 2011 7:00 pm

Re: Hotspot captive portal prevent automatic close on redirect after login

Thu Aug 30, 2018 10:19 am

I agree
most of the users think that when they see the WiFI Icon - they are connected , while they don't.

I prefer the hotspot pop up - it save a lot of explaining to the users

but the problem is to make the brower \ pop up stay on - so they can see my homepage

any solutiuon?
 
omalave
just joined
Posts: 6
Joined: Sun Dec 15, 2013 8:51 pm

Re: Hotspot captive portal prevent automatic close on redirect after login

Sun Sep 23, 2018 2:52 am

I think there is no a right anwser for this issue, Android won't show captive portal and I can't find any workaround.. Any help?
 
trace323
Frequent Visitor
Frequent Visitor
Posts: 53
Joined: Thu May 07, 2015 5:52 pm

Re: Hotspot captive portal prevent automatic close on redirect after login

Fri Oct 05, 2018 8:20 pm

I found a way around this. It works like charm and have no issues.
 
reinerotto
Member
Member
Posts: 441
Joined: Thu Dec 04, 2008 2:35 am

Re: Hotspot captive portal prevent automatic close on redirect after login

Fri Oct 05, 2018 8:54 pm

Congrats. So you are the second :-)
Works for Android 7, too, I hope ...
 
David1234
Forum Guru
Forum Guru
Posts: 1293
Joined: Sun Sep 18, 2011 7:00 pm

Re: Hotspot captive portal prevent automatic close on redirect after login

Thu Oct 11, 2018 4:20 pm

maybe you can say what you did?
 
reinerotto
Member
Member
Posts: 441
Joined: Thu Dec 04, 2008 2:35 am

Re: Hotspot captive portal prevent automatic close on redirect after login

Thu Oct 11, 2018 5:17 pm

Sorry, but I do this for a living, and on openwrt.
Besides, impossible to do the same on MT, because not open, and it needs
some software (openwrt-packages; or LINUX, if you want) not available on MT.
I often stated several times here that for hotspots with special requirements, MT is _no_ good choice.
 
akarpas
Member Candidate
Member Candidate
Posts: 103
Joined: Tue Mar 20, 2018 4:46 pm

Re: Hotspot captive portal prevent automatic close on redirect after login

Wed Feb 12, 2020 2:31 pm

I found a way around this. It works like charm and have no issues.
so what is a work around
 
jmangion
just joined
Posts: 2
Joined: Mon Sep 09, 2019 4:46 pm

Re: Hotspot captive portal prevent automatic close on redirect after login

Tue Feb 25, 2020 2:02 pm

Was there a solution for the automatic closing of the fake browser after login? We need to redirect to the default browse to display the status page!!
 
alexanwar
just joined
Posts: 24
Joined: Tue Aug 07, 2018 10:38 am

Re: Hotspot captive portal prevent automatic close on redirect after login

Sun May 31, 2020 5:16 pm

this is what i do and it works:
  1. enable web proxy.
  2. in web proxy access, create entry with dst-host=connectivitycheck.gstatic.com action=deny
    /ip proxy access
    add action=deny dst-host=connectivitycheck.gstatic.com
    
    and put it on very top (number 0).
  3. in the hotspot user profile, check the "transparent proxy" option in the user profile you use.
  4. on "scripts" tab, paste this script into "on login":
    :delay 5
    /ip proxy access
    add action=allow dst-host=connectivitycheck.gstatic.com src-address=$address place-before=0
    
    this will add allow rule in the proxy access for connectivitycheck.gstatic.com after 5 seconds for ip address of current user.
  5. in the "on logout", paste this:
    /ip proxy access
    remove [find src-address=$address]
    
    this will remove the allow access if the user has logged out.
  6. edit your alogin.html find line with "meta http-equiv" and set the number of second you want to pause in the content so ti will be like this one:
    <meta http-equiv="refresh" content="10; url=$(link-orig)">
    
    in above example it's 10 seconds pause.
this trick is working with android, it will hold the after login page (alogin.html) for that duration before android captive portal login close itself. this useful if you want to put advertising banner on that page so user will definitely see it. the issue is this login page cannot be used for browsing, even you click a link you made on that page, the page will still close itself after duration you set on step 6 above. btw, only a limited javascript command can be run on this android captive portal login, do not put complex script here.
tested on android 6 to 10.

for ios i think you should add the check url but i don't know them since there're many of them. perhaps someone here can help?
 
electravis
Member Candidate
Member Candidate
Posts: 259
Joined: Tue Jan 26, 2010 12:06 am

Re: Hotspot captive portal prevent automatic close on redirect after login

Thu Jun 11, 2020 12:26 am

can you explain what you did there?
I can't seem to understad the logic

I have the same problem -
I want to redirect my users to my page after login - but the captive portal is turn off after login
did you mange to "Fix" this problem ?

Thanks ,
Sorry been a while since Ive been on and had to look back as we no longer needed this anymore but what I did was have an address list called LoggedIN which was then part of a fw rule that blocked all traffic to that .gstatic URL. If you were not in the LoggedIN list it wont block you. So after you log in the hotspot the on login option ran the script that added the IP address of the client to the LoggedIN list with the comment of its mac address. This then allowed the device to have the internet to get my post auth page but kept blogging the .gstatic URL so the captive portal would stay open and you would see your post auth page. Then after 15 seconds it would auto-remove the Users IP from the FW list and then the captive portal page would disappear. It was all a timing thing but seemed to work 80% of the time. As I said have not gone back to it in some time so URLs may have changed that need to be blocked.

Who is online

Users browsing this forum: anon31337, AUsquirrel, eworm, mbovenka, VaMpIrEKiNg and 100 guests