Hello, i have some hotspots with captive portal and i would like to redirect https request to the portal in some cases where a device dont detect the portal.
If i buy a valid ssl cert can i place it on the device in order to work correctly w/o error about not valid certificate?
Unfortunately you cannot transparently redirect HTTPS. Every hotspot has this limitation.
To do so is in essence a man-in-the-middle attack, and HTTPS has been designed to detect that and throw up a warning when it happens. When a user requests a secure website like https://www.google.com, the browser is expecting a certificate for that domain name. When instead it gets redirected to your login page and presented with your valid cert, it sees that it does not match google.com and throws up a warning.
You can redirect a HTTP request to HTTPS, but you cannot transparently redirect HTTPS.