Firefox Detectportal GET success.txt

Today I was looking at some Flask-WTForms pcaps to see how they worked when I noticed something weird. Every second or so, Firefox sends a GET request to http://detectportal.firefox.com/success.txt.

Firefox Detectport GET success.txt

After a bit of reading I found out it is used to check whether a client is in a captive portal. These are wi-fi hot-spots which have a web page on which the user has to login, accept a terms of service/EULA or something similar, like for example on Dutch trains:

NS Wifi Portal Page

Firefox tries to get /success.txt from the URL above, if it works, the client is not in a captive portal, but if it fails, the client IS in a captive portal. So when it fails, Firefox runs a bit of JavaScript that shows a pop-up to go to the portal page.