currently I am working on ReactJs project (create-react-app) to open a pdf blob file in the new tab. The code is short and straight forward as below.
window.open(URL.createObjectURL(blob));
Exactly the same code and same browser (new tab for each environment). My local server is work, but my public website is not working, a new tab with blank pdf page!
Until I spend a very long time, I found out if I set the security.csp.enable
to false in Firefox config, the blob url is just working fine for my public website. However this is not a correct way as I am not possible to ask my client to set Firefox config, and disable the config might cause security issue.
In addition, I also tried to add the meta to public/index.html
<meta http-equiv="Content-Security-Policy" content="object-src 'self' blob:;" />
But It just won't work.
I am running out of idea. Please shed some light to me. Thanks!
Note:
- Firefox Version : 74.0 (64-bit)
- Web Server : RedHat Apache HTTP Server
- Public Url Format (example only, not sure this related) : https://server1.uat.mydomain.com:8443/website/
Other Reference: