Coder.comC
Coder.comโ€ข3y ago
jj1122_

CORS error when communicating between subdomains (port-forward wildcard)

Hi! First of all thanks for the community server to talk about this topic!

While setting up Coder and getting used to it with my dev environment, I realized that when I port forward from dashboard using "arbitary" port forward, I realized that when I send request to backend express node server from my react page, it throws CORS preflight error.

I digged in some more and realized that request without header works fine but as soon as I set the header, it throws CORS error.
I checked that it works fine in my local dev environment so I am bit confused.
Also, I think the cookie and body information disappears as well.

I suspect that this happens because Coder checks if the user is authenticated or not,
so I will try modify template to add button without permission check (share = "public") and see what happens.
(It will be awesome to configure port forward setting in the browser as well)

I found related issue and also commented there as well!
https://github.com/coder/coder/issues/5706#issuecomment-1519939084

Thanks ๐Ÿ™‚
GitHub
I'm using coder with caddy to dev my backend project but when using forwarded port api url with XMLHttpRequest (Vue axios) it occurs error Access to XMLHttpRequest at 'https://8001--dev--xx...
CORS is not permitted between multiple subdomain workspace apps  ยท ...
Was this page helpful?