#Spring Boot CORS config having no effect

35 messages · Page 1 of 1 (latest)

astral thistleBOT
#

Project ID: 499c211e-ee48-4f8d-9cbf-b5569a601a8d

dusty dawn
#

499c211e-ee48-4f8d-9cbf-b5569a601a8d

solemn spindle
#

mind sending the domain for your backend?

dusty dawn
solemn spindle
#

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?

dusty dawn
#

Yes, you're correct!

solemn spindle
#

do you know how to see the response headers in the browsers dev tools?

dusty dawn
#

Yeah, under the Network tab, right?

#

But I don't know what to look for haha

solemn spindle
#

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

dusty dawn
#

It should be here?

solemn spindle
#

is this a local request? like 127.0.0.1

dusty dawn
#

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

solemn spindle
dusty dawn
#

I'll split it into 2 parts, wait a second

#

Here it is

solemn spindle
# dusty dawn

this is a request to the railway service, show me a request to the backend running locally please

dusty dawn
#

Oh, ok

solemn spindle
#

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

dusty dawn
#

That's weird. So It should appear under response headers, right?

solemn spindle
#

yes, but your app isnt setting them

dusty dawn
#

hm

#

I'm gonna work on it and when I find the problem, I'll chat here

#

Thank you so much for your help!

#

😄

solemn spindle
#

no problem

dusty dawn
#

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