-
Notifications
You must be signed in to change notification settings - Fork 63
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
Use jbrowse.org link for the alias files to fix CORS errors #1511
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1511 +/- ##
=======================================
Coverage 59.47% 59.47%
=======================================
Files 435 435
Lines 19511 19511
Branches 4552 4552
=======================================
Hits 11604 11604
Misses 7608 7608
Partials 299 299 Continue to review full report at Codecov.
|
There is a lot of content out there on CORS errors and s3 but this one stood out to me https://serverfault.com/questions/856904/chrome-s3-cloudfront-no-access-control-allow-origin-header-on-initial-xhr-req Here is a clue "When a bucket has CORS enabled, Vary: Access-Control-Request-Headers, Access-Control-Request-Method, Origin should be returned unconditionally by S3 -- even for non-CORS requests -- specifically because varying these will cause an important variation in the response. Otherwise, browsers (and potentially other caches and CDNs, though not CloudFlont) will incorrectly try to use their cached versions where they should not be used -- specifically, the browser will have a cached response where no Origin header was sent, and will reuse this response for a subsequent request where an Origin header is needed -- resulting in a cross-origin policy violation." This means the browser might be trying to use a previously cached response for example if you visited the data by plainly visiting the data URL e.g. in my case maybe I visited the URL https://s3.amazonaws.com/jbrowse.org/genomes/hg19/hg19_aliases.txt in the browser and then later Chrome uses that response, which was not visited using a CORS method, and accesses it via the cache, which then results in it thinking Access-Control-Allow-Origin was not set Answers at that link and https://forums.aws.amazon.com/thread.jspa?messageID=796312 which is linked from there may be an alternative that more generally solves this problem |
Hmm, that could maybe explain why using the other S3 path style (i.e. using Edit: looks like you just posted about the workaround in the Serverfault link, which I forgot to read... |
Implemented a possible workaround to generic-filehandle here GMOD/generic-filehandle#71 |
anyone is interested in checking out #71 maybe this PR could be changed into a bump to generic-filehandle |
Looks like that PR does not work and produces "Access to fetch at 'https://s3.amazonaws.com/1000genomes/phase3/integrated_sv_map/supporting/CHM1/pacbio/data/aligned_reads.bam.bai' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled." on any track.. |
Some tracks work but that one, the CHM1 track, fails Link with x-jbrowse: true Works |
Looks like the generic-filehandle#71 didn't consistently work. The above test-cors demonstrated for me at least that there was something wrong with it not working generally for all links even though some links worked |
Could consider the other workarounds discussed in the troubleshooting links posted or just ignore for now |
Unfortunately the remaining workarounds specified are server side and cloudfront based not pure s3 based it seems |
It seems the best thing to do is to clear cache for this case since it appears to be a case of cross-cache contamination. I will close for now It might be good if we can create a better warning for CORS errors, probably catching status=0 |
I created GMOD/generic-filehandle#72 to follow up |
Currently, every time I load up the app I get a CORS error for this file
This is the whole screenshot I see almost every app load
It has been hypothesized that this is due to weird amazon throttling, because it is intermittent and doesn't affect all users
Ian also ran into this for a VCF file once, which makes it somewhat concerning that it would affect other users
This change would specifically help me, because the cloudfront'ed file has no issue, hence this tiny change.
It is some question of whether this should be done to more of our files. I don't know the details or implications of making cloudfront host giant files that we range request against (could be expensive)