#Production CORS error on POST
8 messages · Page 1 of 1 (latest)
It's a custom route. Have you added cors to the route?
You have added the env for the backend that points to your storefront? That might be your CORS issue
@grizzled storm I believe part of your issue is that your next app is configured to hit https://oblik.fit, but something is sitting in front of it and redirecting to https://www.oblik.fit.
So If I hit:
curl 'https://oblik.fit/api/trpc/variant.search?batch=1&input=%7B%220%22%3A%7B%22q%22%3A%22test%22%2C%22region_id%22%3A%22reg_01HH8EBNVE93X9RB7B1Z9FGCFT%22%2C%22offset%22%3A0%2C%22limit%22%3A2%7D%7D' \
-H 'sec-ch-ua: "Chromium";v="127", "Not)A;Brand";v="99"' \
-H 'content-type: application/json' \
-H 'Referer: https://www.oblik.fit/' \
-H 'DNT: 1' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36' \
-H 'sec-ch-ua-platform: "macOS"' \
-v
notice that no CORS headers are coming back, so the browser is blocking it.
If you change your base url to hit https://www.oblik.fit those CORS issues should disappear.
@cerulean burrow Man you saved my life. I been with this issue and posting it for months.
Is weir because I added both urls to the Store CORS env (with and without "www"). But yeah that solved my issue. You are the GOAT 🐐
Oh good, glad I could help!