MERN frontend on public ip (117.162…:80) is not connecting to MERN backend on local ip (192.168…..:4000)

  Kiến thức lập trình

I have created MERN-VITE app and in local host it is working file even on my university network it is working fine and can be accessed from anywhere. But when I got public ip from IT department, the frontend is working fine but it is not fetching data from backend anymore. It is showing some cores error. Fo that I have used
app.use(cores())
Or used specific origin in the cores.
I have also used proxy in the frontend such that if I send request it get proxy from 192.168…
I have opend the port on 4000 for backend. I don’t know what to do anymore.
I discarded frontend with VITE and used html, css in that case also same error

I am expecting a solution regarding problem with cors wrt communication b/w frontend and backend

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT