0

I'm currently learning React to host a personal website (on an Ubuntu server) and am port forwarding it to allow access from the internet.

However, for security reasons, I'd like one or more pages to only be accessed on my LAN. If an external IP attempts to access it, I would like to refuse the request or return a 403 Forbidden code or something.

I'd rather not use JavaScript for this and do something with IP filtering; I feel that would be less secure than preventing it through the actual server software / OS.

I haven't found any resources regarding this problem on stack or otherwise, so I'm not sure if it's even possible.

If it's not, what would be a good alternative?

Thank you

3
  • You did not mention which web server you use, but if you are using apache2, it is possible to setup an htaccess file to block access based on the requested URL or the client IP address, or some combination of both.
    – mti2935
    Dec 3 at 20:42
  • @mti2935 I still have not deployed the server so I could use either Apache or Nginx, I'll keep that in mind for Apache though, thank you
    – Omaro_IB
    Dec 3 at 21:51
  • This is trivial on probably any web server you could name, so when you've chosen one you might have an easier time finding resources yesterday

0

You must log in to answer this question.