Hey all,
I am working on an extension that serves data from my EBS that I connect to through middleware server. To reach the middleware server, I use cloudflare tunnel to obscure my IP - I also stream, so I needed something zero-trust-level secure.
In local testing, my panel is working great and fetching data through the middleware server. Once I migrate to hosted, I now get a failed to fetch error.
When I send the fetch request from the panel, I send it with headers:
headers: {
'Authorization': 'Bearer ' + token,
'Content-Type': 'application/json',
'Origin': âhttps://extension-files.twitch.tvâ
'Access-Control-Request-Method': 'GET',
'Access-Control-Request-Headers': 'Content-Type, Authorization'
}
On the middleware server side, I respond with the following CORS headers for all requests:
res.header(âAccess-Control-Allow-Originâ, â*â);
res.header(âAccess-Control-Allow-Headersâ, âContent-Type, Authorizationâ);
res.header(âAccess-Control-Allow-Methodsâ, âGET, POST, PUT, DELETEâ);
In the capabilities tab of the developer extension page, I have included the DNS of my cloudflare tunnel that hits my middleware server in the âAllowlist panel Urlsâ and âAllowlist for URL Fetching Domainsâ sections.
I have checked Cloudflare to see if any header re-writing is enabled and it is not. All headers should be passed as specified from the panel to the middleware server.
Yet still, I am getting a failed to fetch error.
This is by far my most ambitious CS endeavor to date and I am feeling a bit overwhelmed! The CORS stuff in particular has just been awful to overcome for local testing and apparently now hosted testing too.
Any advice would be greatly appreciated!