Can not upload files: No 'Access-Control-Allow-Origin' header is present on the requested resource

64 views
Skip to first unread message

Soy yo

unread,
Feb 5, 2021, 5:16:41 PM2/5/21
to Tinode General
My webapp is running on example-domain2.com but Tinode is running on example-domain1.com.

Its not possible to upload files to the filesystem because of cors errors:

Tinode log:

I2021/02/05 21:37:51 Upload request /v0/file/u/
I2021/02/05 21:37:51 media upload: 405 operation or method not allowed / method 'OPTIONS' not allowed

Browser log:

Access to fetch at 'https://example-domain1.com:6060/v0/file/u/' from origin 'https://www.example-domain2.com' 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.

I tried:

I modified tinode.conf file and changed:

"fs": {
"upload_dir": "uploads"
},

to:

"fs": {
"upload_dir": "uploads",
 "cors_origins": ["*"]
},

similar like in "s3":{...} example. But it does not work either.

Any ideas how to fix this problem is there is no Access-Control-Allow-Origin header on Tinode's? Thanks.


Gene Sokolov

unread,
Feb 5, 2021, 5:51:36 PM2/5/21
to tin...@googlegroups.com
CORS is not supported for fs. It needs to be added. I'll look into it.

--
You received this message because you are subscribed to the Google Groups "Tinode General" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tinode+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tinode/7efdd2b4-7271-47ae-84bb-67646fd8227fn%40googlegroups.com.

Gene

unread,
Feb 5, 2021, 8:42:01 PM2/5/21
to Tinode General
I've added support in https://github.com/tinode/chat/tree/next (https://github.com/tinode/chat/commit/f3748d39ee3ec75ab272f3d3a30df33d1f56620a). Please try it out and tell me if it works as expected.

Soy yo

unread,
Feb 6, 2021, 11:20:33 AM2/6/21
to Tinode General
But how can I download it?
I only see the last update 26 days ago:

Gene

unread,
Feb 6, 2021, 2:40:20 PM2/6/21
to Tinode General
There is no release yet. You have to build it yourself from the source.
Reply all
Reply to author
Forward
0 new messages