No uploads from cordova app. CORS from http://meteor.local?
Just tried cfs from a cordova app on meteor 1.0:
Looks like the mobile client runs from http://meteor.local (android, not sure how it's done on iphone) and when inserting images from the client, httpCall PUT to /cfs/files/... ends up not reaching the server.
Tried setting FS.HTTP.uploadUrl to something better like __meteor_runtime_config__.ROOT_URL + FS.HTTP.uploadUrl.slice(1) and ran into this CORS issue. Sounds like HTTP.publish needs to allowOrigin http://meteor.local at least? Also, http-methods doesn't seem to have explicit OPTIONS support at the moment? What's the best way to tackle this? Thanks!
Will you guys eventually enable compatibility with the cordova part of meteor? Just wondering if it's worth my time to be forking all your packages and hacking CORS into them if this is something you guys already have on the boilerplate. Would you like a reproduction repo? Let me know the status of this please, we are trying to ship soon. I am happy to help if you would recommend a vector of attack (best way to fork and debug?), I can fix and return a PR.
@raix?
Thanks for your quick attention! :)
@zhenyasav So in order for cfs to integrate with cordova we have to support the fileTransfer api on browsers and server too - its something that we should do at some point.
If you want to help out I think creating a general package implementing fileTransfer support cordova already exists but browser and server, I could add you to the Meteor-cfs-transfer package?
Hi guys! I need it fixed too :+1: Love your package, but my project is mobile-first...
Here's the fix, a PR is on it's way https://github.com/SpendMatic/Meteor-http-methods/blob/master/http.methods.server.api.js#L364-L369 https://github.com/SpendMatic/Meteor-http-methods/blob/master/http.methods.server.api.js#L582-L587
@raix, @aldeed, hello guys. Tried cfs:s3 and it does not work too... On mobile I can't save or even read images.
@dmitriyles cfs:s3 is just a Storage Adapter for cfs, its not direct client to S3 upload like cfs:s3cloud (https://github.com/raix/Meteor-CloudFS)
@zhenyasav maybe the cors headers should be set in https://github.com/CollectionFS/Meteor-cfs-access-point/blob/master/access-point-handlers.js#L39
@raix ok, got it) I think the problem is with origin. Phonegap client tries to call local url http://meteor.local/cfs/files/images/... while it should call my server's url http://example.meteor.com/cfs/files/images/....
ok, so its using relative urls, hmm - so cfs:file url should add absolute url when on meteor cordova.
@raix, re: putting headers in the in the access-point - will that also apply to the OPTIONS preflight? I assume you mean that headers will have to be applied for both PUT and GET separately as well?
@raix, I believe yes.
Just came accross this bug, cfs:file should use absolute url for getting files AND uploading files
Temporary fix so far:
- using Meteor.absoluteUrl and removing the first / in the url provided by CollectionFS
- overriding FS.HTTP.uploadurl
Well it works but on CORS disabled cordova. Any hints to add a special CORS rule on collectionFS upload hook ?
Ok so I am stuck at the same position of @zhenyasav and need this to be fixed before delivering. I have just forgot to +1 this request so
+1 :)
@dmitriyles, I figure it out that I have the same problem.
+1 :)
So, as I see, the only fix we need is to use absolute URL of a server only if isCordova(). In all other cases it works fine and doesn't need changes. Guys, can you fix it?
@raix and I are really busy right now. I haven't been following this issue, but if you submit a PR with a fix, I can release it.
@aldeed , I'd love to, but I use Meteor only for a week, not so advanced... sorry