You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From my zebar page i'm trying to contact an API. This API doesn't support CORS.
The API expects some custom headers for authorization.
I'm using JS fetch() to communicate with the API.
This results in a CORS error:
XXX from origin 'http://asset.localhost' 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.
The only way to solve this is by some sort of "cors-anywhere" proxy, but i couldn't find a way to start a node process automatically with my zebar config.
Describe the problem/motivation
From my zebar page i'm trying to contact an API. This API doesn't support CORS.
The API expects some custom headers for authorization.
I'm using JS
fetch()
to communicate with the API.This results in a CORS error:
When using the
mode: no-cors
in thefetch
options the error disappears, but the API returns a 403 because the "browser" strips almost all headers (see https://developer.mozilla.org/en-US/docs/Web/API/RequestInit#no-cors)The only way to solve this is by some sort of "cors-anywhere" proxy, but i couldn't find a way to start a node process automatically with my zebar config.
I found this Tauri plugin which should solve this issue: https://github.com/idootop/tauri-plugin-cors-fetch but since we can't add plugins ourselves i started this issue.
Describe the solution you'd like
Either:
node
proxy)Alternatives considered
Running my own "cors-anywhere" node proxy. This works but i want this to auto start when my zebar config starts, so i don't have to do that manually.
Ideally this should not even be necessary if there is a tauri plugin that can solve this.
The text was updated successfully, but these errors were encountered: