Hi,
I am using a mAP2n access point (v6.30.4) connected to a Raspberry Pi to serve web pages using Lighttpd.
The set-up is an intranet, so there is no general internet connectivity.
I have configured the Mikrotik hotspot and walled garden only to serve certain domains (hosted on the RPi) and to redirect requests for all other domains to a landing page. There is no user login, only redirection.
This works for most devices (including Android phones and tablets) but some devices (including all Apple devices) seem not to be redirected to the landing page. Instead, iPhones, Macbooks etc. all get served the default page in the lighttpd.conf (in this case /mnt/external/www/index.html).
Why is the hotspot treating some clients differently to others? Is the fact that many of these clients are Apple significant or a red herring?
/flash/hotspot/ contains one file (redirect.html), which contains:
$(if http-status == 302)Hotspot Redirect$(endif)
$(if http-header == "Location")http://welcome.local$(endif)
<html>
<head>
<title>Hotspot Redirect</title>
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="-1" />
<meta http-equiv="refresh" content="0; url=http://welcome.local">
</head>
</html>
Correct behaviour (302, redirect to intranet landing page) from most devices:
$ curl -v http://an-external-domain.com/
* Trying 192.168.103.254...
* TCP_NODELAY set
* Connected to an-external-domain.com (192.168.103.254) port 80 (#0)
> GET / HTTP/1.1
> Host: an-external-domain.com
> User-Agent: curl/7.51.0
> Accept: */*
>
< HTTP/1.1 302 Hotspot Redirect
< Cache-Control: no-cache
< Content-Length: 141
< Content-Type: text/html
< Date: Thu, 01 Dec 2016 14:52:46 GMT
< Expires: 0
< Location: http://welcome.local
<
<html>
<head><title>Error 302: Hotspot Redirect</title></head>
<body>
<h1>Error 302: Hotspot Redirect</h1>
</body>
</html>
* Curl_http_done: called premature == 0
* Connection #0 to host an-external-domain.com left intact
Incorrect behaviour (200, no redirect, served wrong page) from some devices:
$curl -v http://an-external-domain.com/
* Trying 192.168.103.254...
* TCP_NODELAY set
* Connected to an-external-domain.com (192.168.103.254) port 80 (#0)
> GET / HTTP/1.1
> Host: an-external-domain.com
> User-Agent: curl/7.51.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: text/html
< Accept-Ranges: bytes
< ETag: "2707996152"
< Last-Modified: Tue, 06 Dec 2016 10:24:25 GMT
< Content-Length: 49
< Date: Tue, 06 Dec 2016 13:51:06 GMT
< Server: lighttpd/1.4.31
<
This is the page at /mnt/external/www/index.html
* Curl_http_done: called premature == 0
* Connection #0 to host an-external-domain.com left intact
Any help greatly appreciated. This is very puzzling.