Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

181
Visualizações
CORS policy issue when hitting request from angular

I am receiving a CORS error from my browser when calling a JAVA RS endpoint that redirects to another URL.

When I call my RS end point from my Angular front-end, I get the following error:

Access to XMLHttpRequest ' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

If I hit the RS end point directly from my browser, I do not get the issue. So, if I call baseUrl/rs/testWebService directly in my browser, all is good and I am redirected, however if I go through the front-end on say a button click and do a HTTP GET request, I get the CORS issue. That is, if I have the following typescript code:

testWebService():Observable<HttpResponse<any>> {
    return this.http.get('rs/testWebService',{observe: 'response'});
}

testWebService().subscribe(response => { 
    if(response.status == 200) {
        //do something
    }
});
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda