title: Is there a way to implement captive portal on windows hotspot?
body: <p>I am looking for a way to implement a captive portal for the windows 10 - mobile hotspot. The idea is to redirect all devices that connect to the hotspot to a webpage. </p>
  
  <p>I was able to find this <a href="https://www.shellvoide.com/wifi/how-to-setup-captive-portal-login-with-rogue-ap-nginx/" rel="nofollow noreferrer">article</a> which shows how to do it in linux.</p>
  
  <p>But I have been unsuccessful in finding a similar one for windows. Posts like <a href="https://social.technet.microsoft.com/Forums/lync/en-US/c9271b75-eb72-4a0a-a975-32aacabe48a7/setup-dhcp-server-with-wifi-direct-in-legacy-mode?forum=winserveripamdhcpdns" rel="nofollow noreferrer">this</a> one proved to be dead ends.</p>
  
  <p>I am okay with using a simple nginx server to give 302 redirect response to clients if needed, but prefer not to use any existing software that implements a captive portal.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I have succeeded in triggering a captive portal on clients (linux laptop, android device etc) using a workaround. </p>
  
  <p>Whenever a device connects to the hotspot it sends a request to some predefined websites to check if the wifi connection has internet access. If it gets a 302 response it generates the captive portal window.</p>
  
  <p>So I added the following entries to the hosts file on windows machine.</p>
  
  <pre><code>127.0.0.1 clients3.google.com  #android
  127.0.0.1 connectivitycheck.gstatic.com  #android
  127.0.0.1 nmcheck.gnome.org  #ubuntu
  </code></pre>
  
  <p>These requests will then be resolved locally using the hosts file entries and sent to the nginx server which gives a 302 redirect to all http requests.</p>
  
  <p><a href="https://i.stack.imgur.com/bbak7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bbak7.png" alt="enter image description here"></a></p>