13

Good day. I need Captive Portal on the WiFi hotspot that will work without internet and popup a notification or open a login page automatically. I am using Mikrotik with RouterOS 6.27. I created hotspot and then added a RegExp in DNS like

.* = HOTSPOT_IP_ADDRESS

It works fine in Windows and iOS since their captive portal detection is based on getting the response from some website. Afaik - any response. But for Android it must be some special response, with empty content or status code 204 - I am still not sure.

I tried to emulate google pages which give 204 or empty response and did redirection to my server with this emulation pages but it did not help Android to show notification.

So I need help to make captive portal notification in Android without internet.

Thanks.

Taras
  • 391
  • 4
  • 10
  • Basically you should redirect the query to your own server (e.g. apache) and prepare it to give the 204 response via it's mod_rewrite module. I have not yet tested myself though. – r0berts Aug 01 '18 at 15:33
  • Sorry, how stupid of me - you wanted the opposite. Well - in my case it always pops up; my challenge is rather how to open the webpage in chrome - not the captive portal assistant. So I would guess you need to not send android the response it wants and that is bringing the notification up. Of course - you can serve whatever page for login, but the challenge is how to go to your needed page in full browser. – r0berts Aug 01 '18 at 15:36

1 Answers1

3

Everytime your phone gets associated to the APs it will send an initial test URL request. It's a feature of Android to detect that it is trapped and offer to take the user to the splash page so the user can login and release from the trap.

Just make sure that Android's test URL file is allowed to pass the walled garden.

For reference, default Android 4.0.1 AOSP test URLs is http://clients3.google.com/generate_204, which always returns a 204 response code. Even if DNS has been interfered with since in that case a 200 code will be returned instead of the expected 204.

Also, there are some variations with fetching http://www.google.com/blank.html, which will return a 200 code with zero-length response body. So if you get a non-empty body this would be another way to figure out that you are behind a walled garden.

Ciro Pedrini
  • 4,135
  • 1
  • 11
  • 17