Hi. My problem is when I try to fetch the PDF file from another domain (using DFlip extension) I got CORS problem. The problem says:
Access to fetch at 'https://www.africau.edu/images/default/sample.pdf' from origin 'https://odskocna-daska.web.app' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
I using the Firebase Web Hosting (example: mywebsite.web.app) with HTML, CSS and JS. How to reslove that CORS problem to my website on Firebase Hosting can reach other domain?
My current firebase.json configuration file:
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
Please help. Thanks advance.
What I have tried:
{
"hosting": {
"public": "_site",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"headers": [{
"source": "**",
"headers": [{
"key": "Access-Control-Allow-Origin",
"value": "*"
}, {
"key": "Access-Control-Allow-Credentials",
"value": "true"
}, {
"key": "Access-Control-Allow-Headers",
"value": "Access-Control-Allow-Origin, Access-Control-Allow-Credentials"
}]
}, {
"source": "**/*.@(jpg|jpeg|gif|png)",
"headers": [{
"key": "Cache-Control",
"value": "max-age=7200"
}]
}],
"redirects": [{
"source": "/amp/news/:post*",
"destination": "https://example.com/news/:post*",
"type": 301
}
]
}
}
That is example from GitHub but it doesn't work.