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

Add CORS support for s.codepen.io #1589

Closed
3 tasks done
maya opened this issue Feb 2, 2018 · 19 comments
Closed
3 tasks done

Add CORS support for s.codepen.io #1589

maya opened this issue Feb 2, 2018 · 19 comments
Assignees

Comments

@maya
Copy link

maya commented Feb 2, 2018

Description of feature or bug

I have this CodePen: https://codepen.io/USWDS/pen/BYjrRK?editors=1100

and getting this error in the console in Chrome:

Access to Font at 'https://federalist-proxy.app.cloud.gov/preview/uswds/uswds/add-utilities/dist/fonts/sourcesanspro-bold-webfont.woff2' from origin 'https://s.codepen.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://s.codepen.io' is therefore not allowed access.

From @jseppi:

So, federalist would have to add some CORS headers. I think that can be done either at the S3 level or in our proxy. It’s not a technical big lift.

Definition of done

"pens" on s.codepen.io can AJAX-in assets from Federalist sites through federalist-proxy.app.cloud.gov

Testing pen: https://codepen.io/anon/pen/mXrXVR?editors=0011

After evaluating, edit this part:

Level of effort

low medium (updated)

Implementation outline (if higher than "low" effort):

@maya
Copy link
Author

maya commented Feb 5, 2018

It would be great to have this by next week (2/12) when we plan to start using this in user testing. cc @wslack @jseppi

@wslack
Copy link
Contributor

wslack commented Feb 5, 2018

this is pending compliance approval

@wslack
Copy link
Contributor

wslack commented Feb 6, 2018

@jseppi this has to be manually deployed, right?

@wslack
Copy link
Contributor

wslack commented Feb 6, 2018

should we test it with staging first?

@jseppi
Copy link
Contributor

jseppi commented Feb 6, 2018

Yup. I've already deployed the change to federalist-proxy-staging.

@jseppi jseppi changed the title Add CORS support Add CORS support for s.codepen.io Feb 6, 2018
@jseppi
Copy link
Contributor

jseppi commented Feb 6, 2018

Unfortunately, this isn't working in staging :(

It seems there is some other level (S3 probably or maybe CloudFront) that is adding its own Access-Control-Allow-Origin header, which results in a duplicated header, and thus an error:

screen shot 2018-02-06 at 3 18 27 pm

@jseppi
Copy link
Contributor

jseppi commented Feb 6, 2018

Here's the pen where I'm testing this: https://codepen.io/anon/pen/mXrXVR

@wslack
Copy link
Contributor

wslack commented Feb 6, 2018

That's odd. If there was already a header with a wildcard this should have been working already.

Should we remove from staging and see what headers we can see without?

@jseppi
Copy link
Contributor

jseppi commented Feb 6, 2018

huh, so the staging proxy appears to already have some CORS headers, while production does not.

screen shot 2018-02-06 at 4 26 34 pm

@wslack
Copy link
Contributor

wslack commented Feb 6, 2018

That is real odd. And we know its not in the code...is the next step to ask cloud.gov?

@jseppi
Copy link
Contributor

jseppi commented Feb 7, 2018

It's coming directly from the staging S3 bucket:

screen shot 2018-02-06 at 8 02 22 pm

@wslack
Copy link
Contributor

wslack commented Feb 7, 2018

Hmm k. I assume the only people who can see those settings are cloud.gov staff (why would they be different? so odd)

@jseppi
Copy link
Contributor

jseppi commented Feb 7, 2018

Updated the implementation sketch with new details in light of finding out we can set CORS policy directly on the cloud.gov-brokered S3 buckets.

@jseppi
Copy link
Contributor

jseppi commented Feb 7, 2018

Updated again :)

@wslack
Copy link
Contributor

wslack commented Feb 7, 2018

@jseppi I'm good doing a merge to production if we're sure that staging is working

@jseppi
Copy link
Contributor

jseppi commented Feb 7, 2018

Alright, this should be all finished 🎉

Want to confirm, @maya? I'm not seeing any more CORS errors on your pen at https://codepen.io/USWDS/pen/BYjrRK?editors=1101

@maya
Copy link
Author

maya commented Feb 7, 2018

@jseppi LGTM 🎉

yes, I checked some of my pens that had the errors before and they don't have it anymore!

@jseppi
Copy link
Contributor

jseppi commented Feb 9, 2018

@maya: we changed how we're doing this in order to fix the X-Frame-Options problem. Everything looks like it works now to me, but can you confirm, please?

@maya
Copy link
Author

maya commented Feb 9, 2018

Confirmed! Working for me 🎉

@wslack wslack closed this as completed Feb 20, 2018
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