Rocket.chat: Can't upload files when running in a subdir

Created on 2 Nov 2016  路  16Comments  路  Source: RocketChat/Rocket.Chat

Rocket.Chat version: 0.43.0

I attempt to run Rocket.chat in a subfolder and my ROOT_URL is http://mydomain.com/chat .
During a new file upload, a request to http://mydomain.com/ufs/rocketchat_uploads/bpbPdJqJKvSZu6Tr7?token=9bC8e9c938&progress=1 is sent.
This request URL is not prefixed by the subfolder /chat.

file sharing subdir support

Most helpful comment

I'm running v.0.55.1 in a docker container and have the same problem with subfolder and file upload. First thought it is a problem on the docker image and posted it here (https://github.com/RocketChat/Docker.Official.Image/issues/30). But then saw this issue. Is there a statement if and when it will be fixed?

All 16 comments

try setting Administration -> General -> CDN Prefix to "/chat"

Thanks @AlecTroemel but my CDN_PREFIX is already set with my subfolder name, I still can't upload files.
I can't find where this URL ufs/rocketchat_uploads is defined.

hmm. if you manually add your subdir like http://mydomain.com/ufs/rocketchat_uploads/bpbPdJqJKvSZu6Tr7?token=9bC8e9c938&progress=1 does it find the file correctly? I'm running rocketchat 0.45 in a subdir without any issues. Also, what storage type are you using?

I tried to send a POST request to http://mydomain.com/chat/ufs/rocketchat_uploads/, the server return 400. I guess the route is the right one but there is no request data.

Hello.
I have exactly the same issue.
From the development console : Failed to load resource: the server responded with a status of 404 (Not Found). https://my.domain.com/ufs/rocketchat_uploads/aSvtsqvReYYHZwwwP?token=5AE938cb88&progress=0.44993683748009006
Actually I run in a subfolder https://my.domain.com/subfolder and I set my CDN with /subfolder.
@Huljo since the 4th novembre did you find a solution?

Hi @julienkoziel
Nope, didn't find the solution.
I'll take a look again soon.

So I found that the URL is used here, defined here and here.

By adding
javascript UploadFS.config.storesPath = (__meteor_runtime_config__.ROOT_URL_PATH_PREFIX.substring(1))+'/ufs';
to lib/fileUpload.coffee, the client request is sent well but the webapp handler is not catching the request.

Issue created on jalik-ufs repository.

I have exactly the same issue. @Huljo can you share your solution ? Thanks a lot

Your Rocket.Chat version:0.50.1
The issue is not fixed yet.
Hope it will be fixed soon :P

Hi @mattlin, I've created an issue on Jalik-ufs repository and I'm waiting for their reply.
Take a look at my last comment in here : #271567995 to get more details.

@Huljo Thank you very much

The issue still unresolved in v.0.54.2.

Chat is configured to work with http://domain.com/chat URL

On client side there is a post request to the root directory without subfolder:

http://domain.com/ufs/fileSystem/wxuqjpkHyxLdNM9Xy?token=a829CAD9c8&progress=0.1751362907536077

In server log it fails with the following error:

Exception while invoking method 'ufsComplete' Error: ENOENT: no such file or directory, open '/tmp/ufs/wxuqjpkHyxLdNM9Xy'
  at Object.Future.wait (/path-to-rocket-chat/programs/server/node_modules/fibers/future.js:449:15)
  at [object Object].Meteor.methods.ufsComplete (/path-to-rocket-chat/programs/server/packages/jalik_ufs.js:824:24)
  at [object Object].methodsMap.(anonymous function) (/path-to-rocket-chat/programs/server/packages/rocketchat_lib.js:1095:26)
  at maybeAuditArgumentChecks (/path-to-rocket-chat/programs/server/packages/ddp-server.js:1817:12)
  at /path-to-rocket-chat/programs/server/packages/ddp-server.js:905:20
  at [object Object]._.extend.withValue (packages/meteor.js:1122:17)
  at /path-to-rocket-chat/programs/server/packages/ddp-server.js:904:41
  at [object Object]._.extend.withValue (packages/meteor.js:1122:17)
  at /path-to-rocket-chat/programs/server/packages/ddp-server.js:903:46
  at [object Object]._.extend.protocol_handlers.method (/path-to-rocket-chat/programs/server/packages/ddp-server.js:876:21)
  at /path-to-rocket-chat/programs/server/packages/ddp-server.js:755:85

    - - - - -
  at Error (native)

One mode issue with Rocket.Chat installation in subfolder is that redirect URL from OAuth custom module (actually it's is my module based on build-in rocketchat-oauth-custom module) isn't correct.
Instead of the following:

http://domain.com/chat/_oauth

it generates this one:

http://domain.com/_oauth/chat

I'm running v.0.55.1 in a docker container and have the same problem with subfolder and file upload. First thought it is a problem on the docker image and posted it here (https://github.com/RocketChat/Docker.Official.Image/issues/30). But then saw this issue. Is there a statement if and when it will be fixed?

I have exactly the same issue running rocket.chat in Docker:
OS: Ubuntu 16.04
rocket.chat version: 0.57.2

If I set ROOT_URL to http://localhost:8080/chat everything works perfectly fine except a the file upload. Checking the developer console on my browser I get the following error when trying to upload a file:

Request URL:http://localhost:8080/ufs/GridFS:Uploads/ByuAbT4u4NC69woyd?token=0AfaEA996b&progress=1
Request Method:POST
Status Code:404 Not Found
Remote Address:[::1]:8080

@rocket-cat close
I'm closing this due to lack of activity
Please test on the latest version of Rocket.Chat before reopening or creating a new issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tanc picture tanc  路  3Comments

karlprieb picture karlprieb  路  3Comments

Buzzele picture Buzzele  路  3Comments

mddvul22 picture mddvul22  路  3Comments

Kiran-Rao picture Kiran-Rao  路  3Comments