-
Notifications
You must be signed in to change notification settings - Fork 513
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
Per-example HTTP header setting / SharedArrayBuffer examples #2105
Comments
@mdn/core-dev Please see @hamishwillee question above. Thank you. |
@mdn/core-dev - ping? |
Thanks for the ping, TIL about those headers. I think we have a manually deployed AWS Lambda that sets response headers for the interactive examples and I will be looking into it next week. As for the local server, this should be doable in yari. |
@caugner Any further thoughts on this one? |
How about making BOB use express instead of http-server and allow interactive examples meta.json files to list HTTP headers which should be set for an individual example? @caugner I would be up for it. |
This comment was marked as spam.
This comment was marked as spam.
@hamishwillee Can you elaborate on which domain those headers need to be set (i.e. on developers.mozilla.org, or on interactive-examples.mdn.mozilla.net)?
Unfortunately, this would only be a local solution. On stage/production, the interactive examples are served as static files via Amazon Cloudfront and AWS S3, without using http-server. |
@hamishwillee Let me know if this is still important to you. :) |
@caugner It's important because examples like SharedArrayBuffer.slice don't currently work.
I think there might be consequences though. In BOB there is |
@caugner Yes: still interested, because this blocks the examples working. I think these headers need to be set on interactive-examples.mdn.mozilla.net. My knowledge of CORS is weak, but my understanding is it is the origin that serves resources that decides how it will respond to cross-origin requests. In this case the iframe is embedded in developer.moz ... so it is the interactive examples that need to allow themselves to be served. Note, my suggestion was a mechanism to dynamically allow headers to be set. For this particular case we know what the headers required are, but there might be other cases where other ones are needed. |
@NiedziolkaMichal @hamishwillee To test this, I have added the two headers to stage. See:
The theme switching still works, but I'm still getting Are we missing another header? |
@caugner I see that it works fine if the interactive example is displayed outside of an iframe. |
@caugner Back on Friday, I will also have a look then, unless @NiedziolkaMichal is able to debug this first! |
Sorry, I didn't get around to this, and might not today. Still on my list though. |
Thank you guys for continuing on fixing this. I was about to post a duplicate issue about the example on the page still not working but found a chain leading to this page. I can't help you guys work on the infra to fix this but I wish you best of luck getting this working again! 👍🙌 |
I hesitate to comment because I'm not particularly expert, but this seems pretty likely from the security requirements:
Of course that doesn't tell you for sure what your frame needs to do. However you can run It's worth continuing to investigate, but if this proves "impossible" then we might be best launching the interactive examples rather than embedding them. |
@caugner Any thoughts on how we might progress this. We're outside my knowledge by quite a way. |
I thought about this again, and we would probably need to set those two headers on both However, the cross-origin isolation would effectively prevent us from accessing So I asked internally now if there's anything we could do, e.g. mozilla/standards-positions#628. |
@caugner Maybe would it be possible to serve interactive examples from |
The SharedArray and Atomics examples don't work! because the security requirements for SharedArrayBuffer require that these headers are set:
@schalkneethling Is it possible to update the infrastructure such that we can set set a few server headers on a per-example basis? (both on the live version and on the local server?)
Any example that uses (including the atomics example referenced by this issue) will otherwise fail. If the answer is "No" then perhaps we should strip these examples from the set here, and put in some kind of warning if someone tries to use them?
The text was updated successfully, but these errors were encountered: