#Spring Boot CORS config having no effect
35 messages · Page 1 of 1 (latest)
499c211e-ee48-4f8d-9cbf-b5569a601a8d
mind sending the domain for your backend?
Sure, it's https://raioxcape-back-end.up.railway.app
im not a java dev, so forgive me for not being able to full understand that bit of code, it looks like it will register cors headers for all routes on your app?
am i correct?
Yes, you're correct!
do you know how to see the response headers in the browsers dev tools?
when running the app locally your code uses an asterisks for cors, do you see this asterisks in the response headers of a local request
It should be here?
is this a local request? like 127.0.0.1
Sorry, I don't have much experience in this, but I think it is a local request. I'm just typing the url in Google. A remote request would be if I were to send from my front-end app server, right?
I'm accessing it from my local machine
full screenshot please, no crop
this is a request to the railway service, show me a request to the backend running locally please
yep still dont see any cors headers, if your code isnt setting the header locally, its not gonna be setting the headers on railway
get it working locally first
That's weird. So It should appear under response headers, right?
yes, but your app isnt setting them
hm
I'm gonna work on it and when I find the problem, I'll chat here
Thank you so much for your help!
😄
no problem
Add a CrossOrigin annotation in your controllers, Marcos. I have a fully-working implementation with Eureka, Cloud GW and 2 microservices with Spring Boot, let me know if the problem is solved 😄
@dusty dawn I think that would work, but that solution bothers me because I would have to put CrossOrigin on every controller I have. I wish I could annotate the main class with CrossOrigin 😅 Thanks for helping me though.