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

Github CORS requirement clarification #106

Open
kumavis opened this issue Sep 17, 2014 · 12 comments
Open

Github CORS requirement clarification #106

kumavis opened this issue Sep 17, 2014 · 12 comments

Comments

@kumavis
Copy link

kumavis commented Sep 17, 2014

I've been asking Github to enable CORS headers to their HTTPS git servers, but they've refused to do it. This means that a browser can never clone from github because the browser will disallow XHR requests to the domain.
They do, however, offer a REST interface to the raw git data.
Using this I wrote a mixin for js-git that uses github as the backend store.

I am trying to understand if the lack of CORS support is limiting, if you are able to use the raw git data API. I guess this just necessitates the js-github adapter as opposed to using the normal git communication mechanisms. is it otherwise feature complete? Does this include pushing commits back to github?

@creationix
Copy link
Owner

You can do mist everything over the rest protocol, its just that its non standard buggy and really really slow for clones. Also for any sizable repo, you'd hit the rate limit long before finishing a full clone.

-----Original Message-----
From: "aaron" [email protected]
Sent: ‎9/‎17/‎2014 5:14 PM
To: "creationix/js-git" [email protected]
Subject: [js-git] Github CORS requirement clarification (#106)

I've been asking Github to enable CORS headers to their HTTPS git servers, but they've refused to do it. This means that a browser can never clone from github because the browser will disallow XHR requests to the domain.
They do, however, offer a REST interface to the raw git data.
Using this I wrote a mixin for js-git that uses github as the backend store.
I am trying to understand if the lack of CORS support is limiting, if you are able to use the raw git data API. I guess this just necessitates the js-github adapter as opposed to using the normal git communication mechanisms. is it otherwise feature complete? Does this include pushing commits back to github?

Reply to this email directly or view it on GitHub.=

@kumavis
Copy link
Author

kumavis commented Sep 18, 2014

Ah ok, this does seem like a problem. Did the github team give any specific pushback on why they would not enable CORS?

@creationix
Copy link
Owner

No. I've never gotten a reason of why they won't do it. I either get no
response or they say they are looking into it. I've been trying for almost
18 months now.

On Thu, Sep 18, 2014 at 12:58 PM, aaron [email protected] wrote:

Ah ok, this does seem like a problem. Did the github team give any
specific pushback on why they would not enable CORS?


Reply to this email directly or view it on GitHub
#106 (comment).

@kumavis
Copy link
Author

kumavis commented Sep 19, 2014

I sent an email and filed an issue on Isaac's unofficial github issue tracker isaacs/github#263

@davidgiven
Copy link

Is this still an issue?

@creationix
Copy link
Owner

As far as I know, they never responded. The joys of putting all our open source ecosystem in the hands of a closed-source company. Maybe we should reach out again now that they are part of Microsoft? Anyone have good contacts there?

@easrng
Copy link

easrng commented Sep 21, 2019

try using no-cors fetch instead of XHR. It might not work do to restrictions though.

@davidgiven
Copy link

What is no-cors fetch?

@easrng
Copy link

easrng commented Oct 3, 2019

Fetch is a new JavaScript function that supersedes XHR that has 2 modes: cors and no-cors.
cors mode functions like normal xhr, no-cors lets you request anything, but with limitations on what headers you can get and set.
See https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API

@creationix
Copy link
Owner

I thought no-cors mode didn't allow reading the response. That's pretty essential for this to work.

In addition, JavaScript may not access any properties of the resulting Response
https://developer.mozilla.org/en-US/docs/Web/API/Request/mode

@GeekyDeaks
Copy link

I may have misunderstood, but I think this would be limited to read-only anyway since CORS does not allow credentials for Access-Control-Allow-Origin: *

https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSNotSupportingCredentials

Are you are asking them to echo the Origin header?

neat module btw

@creationix
Copy link
Owner

Credentials would be needed for private repos or pushing changes. But currently I can't even read public repos without CORS enabled on their end.

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

5 participants