https://supertokens.com/ logo
Title
m

mayankgopronto

10/20/2022, 8:17 AM
Hi, I am having trouble with CORS pre-flight request. Getting a
404
response when using a
chi
router. However it works just fine when I use
net/http
. Using this for reference: https://supertokens.com/docs/thirdpartyemailpassword/pre-built-ui/setup/backend#4-add-the-supertokens-apis--cors-setup
n

nkshah2

10/20/2022, 8:18 AM
Hi @mayankgopronto, Can you post the code for SuperTokens init and where you add the cors headers
m

mayankgopronto

10/20/2022, 8:19 AM
Here's the relevant code.
The frontend is running on
localhost:9000
n

nkshah2

10/20/2022, 8:21 AM
And can you post the full error you get
r

rp

10/20/2022, 8:26 AM
@sattvikc can help here
s

sattvikc

10/20/2022, 8:27 AM
sure
m

mayankgopronto

10/20/2022, 8:29 AM
There is nothing is the backend logs.
s

sattvikc

10/20/2022, 8:30 AM
is the OPTIONS request returning 404 ?
m

mayankgopronto

10/20/2022, 4:41 PM
Yes, the
OPTIONS
request returns 404
s

sattvikc

10/21/2022, 6:29 AM
seems like there is some issue with the CORS config. let me check and get back to you
can you confirm which version of chi you are using?
in your code, if you change the chi import to
"github.com/go-chi/chi/v5"
it works fine. Our example also refers to this one.
m

mayankgopronto

10/21/2022, 4:28 PM
I tried using
chi/v5
as well. Same issue.