I have a microcontroller, connected to my WLAN, that hosts a tiny web server. I can reach the http server via 2 ways :
- either via a domain (admin.example.com) which acts as a reverse proxy to the ip of the microcontroller.
- or via the software enabled access point (192.168.0.49) spawned by the microcontroller.
If I reach the server via its domain, i print a login form to the user.
If I reach the server via its local ip in my local network, I want to skip this authentication process (if the user managed to connect to the SoftAP, or is part of the local wlan, I assume he's trusted). Thus I intend to rely on the http "Host" header, like so : If "Host" equals "192.168.0.49" then consider we are authenticated and skip the username/password form.
Is this a safe approach? Can I trust the "Host" header in this context and with such a use case, or can some evil-doer get around this and gain access?