CORS problem with library

@Licat Since v0.12.11 it is possible to perform HTTP requests without CORS restrictions by using request().
But in my case a library (webdav-client) performs the request using axios. Is there another way to avoid CORS restrictions I could use for this?

Axios should work on desktop since it’s Node API, but will not work at all on mobile. There is also no good way of bypassing CORS on mobile other than request().

I would recommend trying to map out the internals of your library to see if they provide any way to override the HTTP calls, which you can then redirect to request if needed. One thing to keep in mind is that request currently only support string data and not binary (you’ll get your response back as a string).

Are you now working on plugins somehow related to webdav sync? I have the same idea too and plz let me know if you have solved such issue :smiley:

@greyovo I have tried many different approaches, but could not find an easy solution to get webdav running on mobile. I think it takes a lot of work and very good JavaScript knowledge

1 Like

Not replying to the author of this post, but more to increase visibility because trying to work around CORS in obsidian took me a while.

Since v0.12.11 it is possible to perform HTTP requests without CORS restrictions by using request().

The documentation doesn’t describe any of its parameters, but does say it’s similar to fetch which is described here

Some examples used in a plug in can be found here

With this piece I was able to finally call the Jira Api to get issue details and replicate the look of a Jira link as shown on a Confluence page using a dynamic react component in Obsidian with a code block, because I wanted up to date ticket information on a dashboard.

1 Like

Would you by chance be open to sharing how you managed this? Ive been trying to make a dashboard that allows me to update worklogs. The requests work fine in postman but im strugling with getting it to work in Obsidian. Im using Custom JS also, what plugin are you using?