-
-
Notifications
You must be signed in to change notification settings - Fork 211
Cannot connect due to CORS error #352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
|
Hi. I am not familiar with the LiveSync plugin, but I have a question.
The current LiveSync plugin latest is v0.21.5. (Releases · vrtmrz/obsidian-livesync) I apologize if this is not relevant. |
|
It is up-to-date now 😀 But it didn't help to resolve the issue, unfortunately. |
|
@thany I had similar issue and found out it was because of the attachment files. Try to put this in nginx conf and restart the service: |
|
I have couchdb running in a docker container, and cannot find a nginx config anywhere. Can you point out where I'm supposed to add that config line exactly? At the filesystem root, Btw, couchdb is an Apache project, so why would they use nginx for the webserver part? 😀 Oh and also, if filesize is the problem, then should it not be able to connect to couchdb in the first place? Because before that happens, it has no chance of even trying to send any file. |
|
I use Nginx for the reverse proxy to access livesync server via a domain name. |
|
And sure I can enable CORS in couchdb itself, but then two more questions would arise:
|
|
I am really sorry, and, thank you all for your patience and cooperation!
We should enable CORS in CouchDB and leave handlings to it. CouchDB will pick a suitable origin for each request from configured values. Each platform uses a different origin.
|
Except the problem is that it too, will throw the same CORS error. But it can be added forcibly on the "Main config" page in the couchdb admin config. Not sure if that's a "healthy" thing to do, because the requirement for http/https is probably there for a reason. Either way, I don't believe Obsidian should behave like it's a faux website. I'm not sure where this should be fixed if possible. Is it a bug in Obisidan, or maybe in Electron? |
|
Thank you for your good point! I have looked into it again, to find what should it be to the CouchDB can accept origins which have non-HTTP schemes neither via HTTP API nor the ini file. A CORS origin could have them, this would be based on old-fashioned CORS specification (RFC-6454 and RFC-3986). On the other hand, iOS and Electron use non special-scheme. This might mean that it seems to be well-designed in each their area; even though if they makes very complicated situation for us. I hope that my information will help us! |
|
Hi, I tried configuring it as written here, but it is not working; I still receive CORS. My DB is accessible via Cloudflare Zero Trust Tunnel. Has anyone experienced a similar problem? |
|
I'm using Git by now. Works a million times better, even if not considering the CORS issue. But CORS and Git have never had problems with each other, and it continues to be like that. Again, not sure if the server (github) just happens to be configured correctly, but I keep repeating myself, in that a desktop application should do any CORS things whatsoever. CORS is for websites. |
|
I will reply properly later, but the Origin in "CROSS ORIGIN RESOURCE SHARING" is clearly meant to express the boundary aspects of the security context, and of course, the desktop has the origin of a desktop. It should be. This is also established in the RFCs as previously mentioned. It should not be underestimated, especially in CouchDB, the native web-based database. Incidentally, we can currently connect to periodic sync ignoring CORS. A warning is displayed, though. (We display warnings. We can hide them. If someone needs an option, I could implement this as our risk. However, changing the configuration is the better solution, I think). I have explained this because you asked, and this was not intended to rudely enlighten you. This could only mean that we simply need documentation. I am sorry to put it this way, but I hope you will give it some thought before making any assurances. We would love to be humble with each other. |
|
I said later, but I am replying from my smartphone as I am about to miss the time. Please forgive me for the lack of coherent writing. Sorry for the delay, do you have verbose logging enabled? In particular, if the gateway returns a response, e.g. on Cloudflare, it will always be detected as a CORS error, as the CORS header is not sent. If nothing is shown, would you mind if I asked you to share a report with me which can be generated by the Hatch pane, please? |
|
Thank you so much for your help! I've spent way too much time on this over the past few days, so I'm going to put it aside for now. I was also thinking – maybe it would be helpful to start a Discord community for this project? I sometimes feel hesitant to ask small questions here, like how to get logs and so on. Thanks again! |
|
I apologise for the hand-wringing response (even if I had deep thoughts about it). Quite simply, CORS can be ignored on v0.24.26. @baruchiro So, if I am going to use it, I would prefer something a bit more open, self-hostable and well-connected, for example, a distributed platform like Nostr (I already posted occasionally). I thought it was a very good opportunity, so I decided to create Self-hosted LiveSync Channel on Nostr for trial. Why don't you try it with us? However, I do speak broken English. Always, Grammarly is just guiding me. Without it, some things may not make sense. Please feel free to point it out. Otherwise, you can also ask me directly on Nostr. Anyway, please do not hesitate to ask directly! I always welcome your messages! (If you think I may have forgotten to respond, please don't hesitate to point it out. Indeed, I do forget often). Finally, I would love to thank everyone who has participated in this conversation once again and close this issue for now! Every conversation is inherently a contribution, and I appreciate your patience and contributions. |
|
@vrtmrz, I will continue on Nostr, but why are all the links directed to |
|
@baruchiro However, when I checked it just now, I realised that there was a simple link error. I will also update my profile, but the following are them in njump.me! Thank you for pointing that out! |
Abstract
Suddenly, I can no longer connect to the couchdb server, but only on desktop. On mobile it still works perfectly fine. So with that, the server is configured correctly, afaict.
On desktop though, I'm getting this:
Inspector:

Expected behaviour
Replication completedActually happened
See error above.
Reproducing procedure
Honestly, I don't know what caused this. If I knew I could provide repro steps more accurately. That's kind of a catch-22, isn't it.
Report from the LiveSync
For more information, please refer to Making the report.
Report from hatch
Obsidian debug info
Debug info
Plug-in log
See above.
Network log
See above.
Other information, insights and intuition.
Obsidian itself is up-to-date, the plugin is up-to-date, and couchdb is at 3.3.3.
This problem happens with an admin account as well as with a normal user account.
Just as a heads-up: "Check database configuration" cannot work, because it cannot connect. But again, I didn't touch neither the config nor the server, so the config should still work. And it works on mobile, so it's good.
The text was updated successfully, but these errors were encountered: