Glenn Dayton
Glenn Dayton

Reputation: 1430

Removing "X-Content-Type-Options: nosniff" header from Google Storage public URL

My goal is to serve a static text/javascript file from Google Storage publicly to include as a script tag.

I'm running into this browser error:

"X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.

I curled the Google Storage URL and discovered its 302 redirecting me with the problematic header X-Content-Type: nosniff to another link that contains the actual Content-Type: text/javascript file.

Is there a way to prevent this redirect on a file made publicly available?

Upvotes: 0

Views: 579

Answers (1)

Glenn Dayton
Glenn Dayton

Reputation: 1430

Changing the URL solved the issue of preventing the Google Storage 302 redirect.

from:

https://storage.cloud.google.com/<bucket-name>/script.js

to:

https://storage.googleapis.com/<bucket-name>/script.js

Upvotes: 2

Related Questions