Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request blocked by CORS when trying to download anything #53

Open
MaddoScientisto opened this issue Nov 29, 2023 · 2 comments
Open

Request blocked by CORS when trying to download anything #53

MaddoScientisto opened this issue Nov 29, 2023 · 2 comments

Comments

@MaddoScientisto
Copy link

Version: 1.17.14
Tested browsers: Firefox developer edition 121.0.b4, firefox 115.5.0esr

When I try to download anything I get a CORS error mentioning headers, this doesn't happen on 1.17.10

Dowloading https://instagram.fflr3-1.fna.fbcdn.net/v/t51.2885-15/404312395_252102311209315_1603083148809262124_n.jpg?stp=dst-jpg_e35&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4xNDQweDE2NjUuc2RyIn0&_nc_ht=instagram.fflr3-1.fna.fbcdn.net&_nc_cat=107&_nc_ohc=4xpymMblX5kAX_qJYOI&edm=ALQROFkBAAAA&ccb=7-5&ig_cache_key=MzI0NTQzNzUxMDE5OTcyOTMwNg%3D%3D.2-ccb7-5&oh=00_AfCjQxXco2qckDPywh-qhEkUIDy_gGsFDdtXZzq114Ec1Q&oe=656BF10E&_nc_sid=fc8dfb [Instagram-Download-Button.user.js:704:17](moz-extension://62646158-6073-4760-9255-faf858be51c9/userscripts/Instagram-Download-Button.user.js?id=67ad556a-0dad-4a7e-966f-e3220395d047)
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://instagram.fflr3-1.fna.fbcdn.net/v/t51.2885-15/404312395_252102311209315_1603083148809262124_n.jpg?stp=dst-jpg_e35&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4xNDQweDE2NjUuc2RyIn0&_nc_ht=instagram.fflr3-1.fna.fbcdn.net&_nc_cat=107&_nc_ohc=4xpymMblX5kAX_qJYOI&edm=ALQROFkBAAAA&ccb=7-5&ig_cache_key=MzI0NTQzNzUxMDE5OTcyOTMwNg%3D%3D.2-ccb7-5&oh=00_AfCjQxXco2qckDPywh-qhEkUIDy_gGsFDdtXZzq114Ec1Q&oe=656BF10E&_nc_sid=fc8dfb. (Reason: header ‘user-agent’ is not allowed according to header ‘Access-Control-Allow-Headers’ from CORS preflight response).

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://instagram.fflr3-1.fna.fbcdn.net/v/t51.2885-15/404312395_252102311209315_1603083148809262124_n.jpg?stp=dst-jpg_e35&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4xNDQweDE2NjUuc2RyIn0&_nc_ht=instagram.fflr3-1.fna.fbcdn.net&_nc_cat=107&_nc_ohc=4xpymMblX5kAX_qJYOI&edm=ALQROFkBAAAA&ccb=7-5&ig_cache_key=MzI0NTQzNzUxMDE5OTcyOTMwNg%3D%3D.2-ccb7-5&oh=00_AfCjQxXco2qckDPywh-qhEkUIDy_gGsFDdtXZzq114Ec1Q&oe=656BF10E&_nc_sid=fc8dfb. (Reason: CORS request did not succeed). Status code: (null).

TypeError: NetworkError when attempting to fetch resource. [Instagram-Download-Button.user.js:726:33](moz-extension://62646158-6073-4760-9255-faf858be51c9/userscripts/Instagram-Download-Button.user.js?id=67ad556a-0dad-4a7e-966f-e3220395d047)
    downloadResource moz-extension://62646158-6073-4760-9255-faf858be51c9/userscripts/Instagram-Download-Button.user.js?id=67ad556a-0dad-4a7e-966f-e3220395d047:726

​
@pootz10
Copy link

pootz10 commented Dec 5, 2023

When I saw the script wasn't working anymore and I saw this error on my console, telling about user-agent
I changed this line

headers: new Headers({
                'User-Agent': window.navigator.userAgent,
                Origin: location.origin,
            }),

for this one
headers: new Headers(),

I download only stories using this script, and now it's working for me, but I'm not sure if is enough to fully working.
Trying to download from instagram.com it fails, but directly from the instagram profile, or stories it's working.

@Patty-OFurniture
Copy link
Contributor

Ref #64 - this fix would also be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants