Content-Security-Policy-Report-Only from app.hubspot.com is reporting errors to browsers

When embedding a Hubspot form in a website, Chrome is showing the following issues in Devtools:

Refused to frame app.hubspot.com because an ancestor violates the following Content Security Policy directive: “frame-ancestors ‘self’”.

I tried several changes to my own site’s Content Security Policy however I am sure this is because the Content-Security-Policy-Report-Only is incorrectly configures on the domain app.hubspot.com where this is the directive:

frame-ancestors ‘self’; report-uri …

As far as I understand how frame-ancestors works, this directive is basically saying that only app.hubspot.com can use the reporting API? However the idea of the Reporting API is that clients send their issues to it when an error or issues occrurs in their browser. Hence I believe the correct change to remove these errors in clients browsers would be to remove the frame-ancestorsdirective.

More information is available here: Content-Security-Policy-Report-Only header - HTTP | MDN

Hey @AndrewHo

Welcome to the Community!

Could you send a link to where the form is embedded so we can take a look?

I also have the same error, plus I cannot see the form properly in mobile… if someone can help, it would be very appreciated. The link is https://toscanabike.it/escursioni_mtb/da-lucca-a-viareggio-in-mountain-bike-nuova-variante/

thanx

Hi @toscanabike ,

I am seeing an error on your site, but it is not the same.

It is Uncaught TypeError: hbspt.forms.create is not a function

@LisbethN asked the same question here.

I would look at the steps in that post to see if that helps out.

Hi, I’m having the same issue. Page: Flat Panel X-ray Detector with SpectralDR® | Reveal™ 35C

Content Security Policy of your site blocks some resources because their origin is not included in the content security policy header

How’s the best way to solve this?

I am having this same issue! Has anyone managed to resolve it?

The best bet would be work with your site admin to update the content security policy

Here is some documentation on it.

The original poster is correct, this needs to be handled by Hubspot. The frame-ancestors content security policy setting is on Hubspot’s side to change. In Hubspot’s CSP for `https://app.hubspot.com/\` frame-ancestors is set to ‘self’. This means that `https://app.hubspot.com` is only allowed to be loaded on app.hubspot.com itself and not in an iframe on any other domains.

However, when you use the form embed code it tries to load `https://app.hubspot.com/forms-next-v2-captcha` as part of the payload. So this either needs to be moved to another domain that is allowed to be embedded in iframes or remove the frame-ancestors directive from the app.hubspot.com CSP.

Hi all, we managed to resolve this issue. In our case, it was because our site did not support iframes. Every Hubspot code is essentially, in an iframe. It took some work form our developer but it was a pretty quick fix.

That’s great news, GCiampa. Could your developer provide any guidance as to what the fix was? We are really struggling here with this same issue and would love to see if we could replicate your approach.

Same issue is causing your scripts such as forms.hubspot.com from loading in Firefox, Chrome and Safari (browsers detecting it as an invalid CORS request and blocking it), because of this our lead captures from forms aren’t working.

Hello, we’re having the exact same issue with the Content Security policy. Has anyone resolved this yet?

@dennisedson This seems like it can only be fixed on HubSpot’s side.
Could you confirm if HubSpot acknowledges that’s the case and if they plan to work on a fix?

Hey all, The team is looking into this. I will report back when I have an update.

Hi Dennis, did you solve this issue? now even the messages are not delivered via HubSpot forms

The team is looking into it. Will report back when I have confirmed the resolution

Same situation here. I tried to update things on my end but it did not fix the issue. Hoping for a fix on HubSpot’s side.

I have the same issue. Any news?

@AlbertoSM , not yet, but I do know that it is being worked on.

OK everyone, I have been told that a fix has been deployed. Let me know what you all are seeing out there now :grinning_face: