parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

GridStoreAdapter files location

Open davimacedo opened this issue 10 years ago • 5 comments

Because of https://github.com/ParsePlatform/parse-server/blob/master/src/Adapters/Files/GridStoreAdapter.js#L66 when using nginx (or other) to proxy requests, you don't have enough control over the files location url.

My suggestion is to use like it currently is as a default behavior but add an optional parameter in the GridStoreAdapter to set the file location (instead of the default config.mount).

I would like to know if a contribution about it would be welcome.

davimacedo avatar Mar 22 '16 12:03 davimacedo

@davimacedo would you set a publicServerURL, and use that as the base? Would that provide a proper fix for you?

flovilmart avatar Mar 22 '16 12:03 flovilmart

@flovilmart I will try today and revert to you. thanks.

davimacedo avatar Mar 24 '16 04:03 davimacedo

@flovilmart @davimacedo the publicServerURL didn't work here at back{4}app.

We've tested through files being shown with "http://" (They're served under both HTTP and HTTPS protocols). But we needed it to be "https://" by default. So, the problem was solved by adding the "X-Forwarded-Proto" header as "https" on nginx and adding "app.enable('trust proxy');" to our express. Then, config.mount will receive the desired protocol on req.protocol.

That solved our problem, but we still think that there could be another way to do that, just like suggested on https://github.com/ParsePlatform/parse-server/issues/1131#issuecomment-199785174. We're willing to contribute about it.

seijiakiyama avatar Mar 24 '16 22:03 seijiakiyama

We are also behind nginx on AWS. Is it also possible to implement a custom GridStoreAdapter and configure it while creating the server? Something like this...

var gridStoreAdapter = require('parse-server'). GridStoreAdapter; var api = new ParseServer({ ... filesAdapter: new gridStoreAdapter('http://my.mount.url'), ... });

justinmfischer avatar Mar 25 '16 16:03 justinmfischer

@seijiakiyama we're waiting on your contribution then!

flovilmart avatar Mar 30 '16 23:03 flovilmart