#learner - CORS

1 messages · Page 1 of 1 (latest)

clever sun
#

Hi 👋

#

What errors are you seeing?

#

What is the context?

turbid falcon
#

While implementing https://helmetjs.github.io/ for security, we see errors like ERR_BLOCKED_BY_RESPONSE.NotSameOriginAfterDefaultedToSameOriginByCoep

#

GET https://www.mydomainname.com/css/global/fonts/ProximaNova.css net::ERR_BLOCKED_BY_RESPONSE.NotSameOriginAfterDefaultedToSameOriginByCoep 200

hollow yacht
turbid falcon
#

Thanks Karbi. That helps

#

@hollow yacht So we always need to disable crossOriginEmbedderPolicy: false, in the Helmet config when using it with Stripe?

hollow yacht
#

correct

steady jay
#

hello again @turbid falcon -- re-opening this

#

You found another approach?

turbid falcon
#

Yes, if Stripe starts providing Cross-Origin-Resource-Policy Header, we can avoid crossOriginEmbedderPolicy: false as it makes thing less secure. Can Stripe provide this header?

terse dove
#

Hello! What specific content would you like to see us put in that header?

turbid falcon
#

I think mere setting it should help resolve this?

terse dove
#

Looking at that it sounds like it's a header you would need to set, not us. Have you tried setting that header on your server to cross-origin?

turbid falcon
#

The message reads server needs to set the header. So the Server hosting Stripe.js would need to set the header?

terse dove
#

I believe that's referring to the server hosting the website that's trying to use a cross-origin resource, which would be your server.

turbid falcon
#

The StripeJS gets served to the browser client from Stripe server not ours

terse dove
#

Right but your web page is the one being served to the browser client first, then your page tries to load Stripe.js, but if you don't have that header set it's going to cause issues with your configuration because Stripe.js is on a different origin than your site.

#

That's why it says "to use this resource from a different origin" in your screenshot. Your website's origin is different from Stripe.js' origin.

#

Is your server currently sending the Cross-Origin-Resource-Policy header? If so, what's the value?

turbid falcon
#

it's set to same-origin on our end

terse dove
#

Right, so that's the problem.

#

You're saying to the browser "only load stuff from the same origin" which is blocking Stripe.js because it's on a different origin.

#

You need to set that to cross-origin or stop setting that header to allow Stripe.js to load.

turbid falcon
#

@terse dove I tried setting it to cross-origin-resource-policy: cross-origin still get the same error

terse dove
#

The same exact error?

#

Is this online somewhere so I can take a look?

turbid falcon
terse dove
#

Wait, so that's the request to fetch Stripe.js... did it succeed? Is Stripe.js working on your site?

turbid falcon
#

Sorry, in case you haven't read the above thread, this started when we introduced Content Security Policy on our end using Helmet

#

Without CSP or with crossOriginEmbedderPolicy: false it works well (Site is not live yet but only deployed on Dev environment behind firewall)

terse dove
#

Yeah, as stated above crossOriginEmbedderPolicy: false is required to make this work. There's no header we could set that would override or change that.

turbid falcon
#

As suggested by Chrome, if Stripe starts providing the header, this might go away?

terse dove
#

Oh, actually, I think I'm mistaken. I'm not that familiar with the Cross-Origin-Embedder-Policy header, but looking into it it does seem like it would respect the header if we set it.

#

Hang on...

#

Apologies for misunderstanding earlier. This is actually being considered internally right now. I can't guarantee we'll implement it or give you a timeframe or anything like that, but we are looking into it.

turbid falcon
#

Thanks @terse dove when should I ask this again?

terse dove
#

I don't have a timeframe. I did flag that you asked about this internally, but I can't say when we'll have news. Maybe check again in a few weeks? It's not likely to change soon, so you'll need to keep that setting set to false for now.

turbid falcon
#

Would it make a difference if we place a formal request with Stripe as we are a paid customer?

terse dove