Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

CORS for oEmbed #188

Open
cpwinn opened this issue Dec 5, 2018 · 5 comments
Open

CORS for oEmbed #188

cpwinn opened this issue Dec 5, 2018 · 5 comments
Labels

Comments

@cpwinn
Copy link

cpwinn commented Dec 5, 2018

When calling the oEmbed provider from JavaScript in a browser there are no CORS headers in the response. This obviously causes the browser to block the request. Any chance we can get a response header like the following?

Access-Control-Allow-Origin: "*"

This happens with all oEmbed requests but here is an example url:

https://giphy.com/services/oembed?url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fcant-hardly-wait-kW8mnYSNkUYKc

and the full requst:

var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
  if (xhr.readyState === 4) {
    console.log(xhr.response);
  }
}
xhr.open('GET', 'https://giphy.com/services/oembed?url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fcant-hardly-wait-kW8mnYSNkUYKc');
xhr.send();
@l0c0luke
Copy link

l0c0luke commented May 9, 2019

I ran into this with a PHP library I have been using for years to get the oembed... now it returns the image saying "are you a robot?"

oscarotero/Embed#185 (comment)

@shwetaatgiphy
Copy link

Hey @cpwinn

We we made changes to CORS header management fairly recently. Please give this a try again and feel free to open the issue if needed.
Hopefully those fixes help.

Thanks.

@cpwinn
Copy link
Author

cpwinn commented Oct 14, 2020

@shwetaatgiphy Looks like this issue is unchanged. You can run the code snippet above in a browser console to reproduce it.

@shwetaatgiphy
Copy link

Gottit, thanks for taking a look @cpwinn!
I'll forward this to the relevant team now & reach out with any updates they may have

@cbieser
Copy link

cbieser commented Feb 19, 2021

@shwetaatgiphy do you have any updates on this issue?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants