I'm getting the public URLs of my images like the below.
const file = admin.storage().bucket().file('...');
await file.makePublic();
file.publicUrl(); // Returns http://localhost:9199/...
It returns URLs with the host set to localhost and it makes it impossible to access them from mobile devices.
I tried to replace localhost with my computer IP address but no luck.
I had to set the port to 0.0.0.0 on the firebase.json file. Then, I can access the images using my IP address instead of localhost.
firebase.json
{
"emulators": {
"storage": {
"host": "0.0.0.0",
"port": 9199
},
...
},
...
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.