Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 2

preflight requests to raw.githubusercontent.com

Solved! Go to Solution.

Hi,

 

I'm trying to pull raw files from GitHub via js in browser. Public files work great, but when I try to get private files, the request fails due to raw.githubusercontent.com *rejecting the OPTIONS preflight request* with 403.

 

Curling on command line, it works fine with an access token, because curl doesn't preflight.

 

```

>curl -is https://$ACCESS_TOKEN@raw.githubusercontent.com/$SLUG/master/module.json
HTTP/1.1 200 OK

```

 

If I manually preflight, the problem appears again:

```
> curl -is -H "Origin: http://localhost:3499" -H "Access-Control-Request-Method:GET" -H "Access-Control-Request-Headers: X-Requested-With" -X OPTIONS https://$ACCESS_TOKEN@raw.githubusercontent.com/$SLUG/master/module.json
HTTP/1.1 403 Forbidden
```

 

I can get the file contents from the content API, but that's clunky because stuff always seems to be base64, even with the raw media type (seems to just strip enclosing json metadata).

 

Could you please consider looking into supporting OPTIONS on raw.githubusercontent.com? Or is there something I could do with the content api to get raw file contents?

 

Thanks!

Vesa

1 Reply
Solution
Community Manager
Message 2 of 2

Re: preflight requests to raw.githubusercontent.com

Thanks for reaching out.

 

I'll pass along the feedback to the development team. I can't make any promises or give an ETA on when something might change, but your request will be in the hands of the appropriate people.

 

Thanks again for letting us know.