Hello, Obsidian community
I enabled debugging with USB on my Android phone and connected to it with
chrome://inspect tab to see what fails in terms of network request on attempt to upload an image.
The HTTP error from the plugin I observe on mobile app is: “429 Too Many Requests” with a human-readable payload in HTTP body: “Imgur is temporarily over capacity. Please try again later.”
I compared the headers from both (desktop and mobile Obsidian apps) to see the difference and to understand why the plugin fails on mobile. One major difference, that I noticed is the
- desktop Obsidian app uses
- while mobile app uses
So, even though the pre-flight request says
Access-Control-Allow-Origin: *, in reality it gets rejected with 429 status code. I would say it’s not a CORS restriction, but I am pretty sure it’s still a problem of a
Origin, which is kind of banned by the target server.
I’ve tried to provide custom value for
Origin, but it looks like I do not have control over it since the value in real request does not change (I use
fetch API btw)
From Make HTTP requests from plugins - #8 by intellectronica I’ve read a couple of tricks:
- using NodeJS libs for making HTTP requests (can work only on desktop Electron app)
- using a middleware/proxy server (which seems to have the same limitation as a 1st option, because mobile app is not a NodeJS app; or I need to host middleware somewhere outside of Obsidian, which I do not consider as an option)
So, is there any other chance for me to adjust
Origin header sent by mobile app or Obsidian mobile app behaves strictly like a browser, because it’s powered by Android WebView?
If I can not change
Origin in Obsidian mobile, is it possible for Obsidian mobile developers change the value from
app://obsidian.md, like it’s done for Desktop app where my plugin works?