I want to know the FQDN of the sender when I send a POST from Cloud Functions

105 Views Asked by At

I use Node.js of Cloud Function. This is part of my program.

const postDevice = (user, device) => {
  const options = {
    host: user.host, //URL
    port: device.port, //PORT
    method: 'POST',
    ContentType: 'text/plain',
    //ヘッダーに指示内容をセット
    headers: {
      email: '[email protected]',
      device: 'TV',
      action: 'ON',
    },
  };
  const req = http.request(options, (res) => {
    res.setEncoding('utf8');
    res.on('data', (chunk) => {
      console.log('BODY:', chunk);
    });
    res.on('end', () => {});
  });
  req.end();
};

I want to know the FQDN of the sender when I send a POST from Cloud Functions.

I tried to verify the FQDN from the device receiving the POST request but could not.

Also posted on: https://groups.google.com/g/firebase-talk/c/pARy7cXJ2Q8

1

There are 1 best solutions below

0
Chanpols On

Posting this as a community wiki so that others can benefit from it.


As mentioned by @John Hanley:

Cloud Functions is a large collection of servers. There is no FQDN for you to use or lookup that would uniquely identify your function so that I firewall could whitelist your function. If you require an FQDN, use Compute Engine and configure reverse DNS (ptr record). The equivalent does not exist for Cloud Functions as that is a shared service.


You may check this link for Compute Engine | Internal DNS.