node.js - Firebase CORS, whitelist IP ranges -
i need whitelist 2 ip ranges access firebase cloud functions, how can achieved? pretty sure should way define them here:
const cors = require('cors')({ origin: true });
but couldn't find on google syntax
per configuration docs npm cors
package, can use array origin
value:
origin: ["http://example1.com", /\.example2\.com$/]
each element in array can either string
or regexp
.
or can use single regexp
value:
origin: /example\.com$/
i need whitelist 2 ip ranges
since values specified in origin
option matched against value of origin
request header browser sends, if origin
values sent contain ip addresses instead of hostnames, specifying ip-address regexp
in origin
option should work.
but if origin
values sent in requests instead contain hostnames, you’ll need either specify array of hostname string
s in origin
value, or else regexp
they’ll match.
Comments
Post a Comment