I plan to make a web application. The workflow will be the client scan QR code using his phone to go to some specific URL.
But interested to me is there any option to I can limit visit that URL if the request didn’t comment from a specific WiFi network? I do not want to anybody take a photo and fake requests.
Advertisement
Answer
There are multiple ways to do it:
If your specific WiFi network has a fixed WAN IP / IP range, you can write your application to detect the client IP and check if they came from there. You may check
$_SERVER['REMOTE_ADDR']
for the client’s IP (if your server is not behind reverse proxy). Your server is still publicly available, but your PHP code will only allow the whitelisted IP to access the certain URL path.If you want even better security, you may place your server in your local network. You can use local IP in your QR code for users to access it. This way, the server will not be available on the internet at all.