Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

spring boot - Setting cookies for subdomain

i'm making a web app in a restful way. For my client side i'm using angularJs, the same is hosted at - lets say - https://domain.com

My backend is built on spring boot and i call all the resources from a subdomain - lets say - https://xyz.domain.com

Now when a user logs in , the backend sends an http only cookie to the client. I can see the cookie in response header but its not being set in the browsers cookie.

After a bit of research, i have tried sending cookie with domain = .domain.com but that didnt work either.

Is there a way i can set cookie coming from xyz.domain.com for my client side at domain.com

(Note - i'm not using www.domain.com )

Any help or clue would be great.

Thank you for going through my question.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The problem you're describing is related to cross domain cookie policies. I don't know your exact use-case, but looking at CORS and P3P headers should give you a good start. As an option, you can try setting your cookie manually via Javascript.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...