1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

How to handle cookies on angular development server when getting info from another domain in...

Discussão em 'Angular' iniciado por Alfonso Tienda, Maio 27, 2025.

  1. I've got a server to which I need to make posts, get, etc. with HTTPClient. This host is example.com:8080, for example. It's a tomcat with JSESSIONID Java cookie.

    When I'm developing, I set the withCredentials: true on a interceptor for sending the cookies to the server. But, of course, I'm in localhost:4200

    If I run the java server locally, i.e. at localhost:8080, after I log in the java application I get the cookie and, running angular dev server in another browser tab, the withcredentials feature is working fine, but now I can't run the java app on local, so I need to send my requests to example.com:8080, so of course it's not working because de domain does not match.

    I tried to set server and local.server in my hosts file, but didn`t make the trick. I'm thinking about a kong api gateway or an nginx as reverse proxy, but seems to much complicated for what I want to do.

    What is the best approach to make this to work?

    Continue reading...

Compartilhe esta Página