CORS Issue on Express / Changes do not take effect.

First, my english is not good so if you have content that is not well understood, comment and requestion to me. thanks

Yesterday, my project on front-end have a cors error like this.

My source code only allow localhost about cors. So i change source code like this.(also success to deploy)(I use cors libary to solving cors problem)

And retry… but nothing change. And i found wierd point.
access-control-allow-origin on http server response does not change.

Please give me some advice. If there’s any information that I couldn’t provide, please leave a comment. thank all :sob: .


What does it look like if you run the app locally?

Do you have that set differently in the app elsewhere?

There was no problem when running in a local environment. (CORS issue not present)

Luckily, my team found possible error in, and fix Like this. successful. Now it’s work!

const frontUrl = process.env.FRONT_URL || "";

apiRouter.use("/", cors({ origin: frontUrl }));

I’m so grateful that you even replied. Thank you very much for your interest in my problem.

Have a good day. jphenow !! :grin:

1 Like

Glad you were able to figure out your issue!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.