0

I want the page of website (e.g."https:// website-URL/admin") only accessible specific IP addresses. I use firebase.google.com & Vercel.com etc. for hosting commonly along with NodeJS & React JS for backend.

  • Not possible with Firebase Hosting: https://stackoverflow.com/a/55447486/8349557 – Ajay Gupta Jun 29 '21 at 02:51
  • Did some research around Vercel and I dont think it’s possible with Vercel either. I think you should talk to the customer support at Vercel. – Ajay Gupta Jun 29 '21 at 02:52

1 Answers1

1

Firebase hosting is delivered through Fastly, when using cloud functions for onCall and onRequest, you can access this from the header fastly-client-ip

Otherwise, if it is from the client, you can call a Cloud Function to check it, or do a remote check with a service, but these kinds of checks are purely cosmetic and can be bypassed if someone created a script to override it.

import publicIp from "public-ip";

export const getClientIp = async () => await publicIp.v4({
  fallbackUrls: [ "https://ifconfig.co/ip" ]
});

npm package: https://www.npmjs.com/package/public-ip

beyond the above options, this feature is limited and not accessible to you directly within Firebase config.

DIGI Byte
  • 4,225
  • 1
  • 12
  • 20