[HELP] CollectionFS and CDN upload file problem


#1

My meteor app uses collectionFS fs:filesystem to store files on server locally.

If no CDN configured or turned on, using collectionFS uploading/downloading file has no problem.

If CDN is configured and turned on, then collectionFS downloading works fine while uploading doesn’t work any more.

My server name is argo.centuryenergy.com.cn, the CDN node visiting is 117.34.112.2,

In chrome console, I saw following error messages:

From these error message, I figured, the POST is trying to upload this file to CDN node (117.34.112.2) instead of real server IP address (119.7.222.172).

Has anyone ran into such problem?

More general question is how to configure collectionFS or CDN to make uploading work.

Have to use CDN to speed up downloading in order to pass Apple App review. Last time it failed to load when no CDN is configured.

Really appreciated if anyone can help, this is kind emergency…


#2

OK, fixed server addres by adding:

FS.HTTP.uploadUrl = Meteor.absoluteUrl() + ‘/cfs/files’;

However this creates CORS issue as following:

Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Any suggestions?


#3

Related bug:


#4

After changing the ROO_ULR to http://argo.borya.im(no CDN configured for it), set:
FS.HTTP.uploadUrl = Meteor.absoluteUrl() + ‘/cfs/files’;
Error changed to :

PUT http://argo.borya.im//cfs/files/fileStore/RgHdD4b7iJAC7tgsJ?chunk=0&filenam…VG9rZW4iOiJFNG05eGlyblRSVXFjUDBsejFVaEZLblNMOTdFbjhfSll3SjdBa3BnXy1ZIn0%3D net::ERR_INCOMPLETE_CHUNKED_ENCODING

On NGINX proxy, the error showed up as:
2015/10/30 21:22:23 [error] 7985#0: *46 readv() failed (104: Connection reset by peer) while reading upstream, client: 111.161.17.111, server: argo.borya.im, request: “PUT //cfs/files/fileStore/RgHdD4b7iJAC7tgsJ?chunk=0&filename=2p.png&token=eyJhdXRoVG9rZW4iOiJFNG05eGlyblRSVXFjUDBsejFVaEZLblNMOTdFbjhfSll3SjdBa3BnXy1ZIn0%3D HTTP/1.1”, upstream: “http://127.0.0.1:3000//cfs/files/fileStore/RgHdD4b7iJAC7tgsJ?chunk=0&filename=2p.png&token=eyJhdXRoVG9rZW4iOiJFNG05eGlyblRSVXFjUDBsejFVaEZLblNMOTdFbjhfSll3SjdBa3BnXy1ZIn0%3D”, host: “argo.borya.im”, referrer: “http://argo.centuryenergy.com.cn/editMeeting/KMwkAZkaP4zacWxZe