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

104
Visualizações
NgRx does an weird redirect to HTTP before go to HTTPS that's cause an CORS ERROR

I'm new with ngrx and I want to use NgRx Data module. I'm in a stack with Angular/Symfony hosted in docker with Traefik (https mode).

I want to do a request to a route named : https://xxx.xxxxxx.localhost/operations This route normally send me my list of operations with standard usage with angular service.

But with NgRx Data module when I called this route I have an CORS ERROR.

NgRx Configuration :

Import and config to my custom endpoint adress in app.module.ts :

imports: [
  HttpClientModule,
  StoreModule.forRoot({}),
  StoreRouterConnectingModule.forRoot(),
  StoreDevtoolsModule.instrument({
   name: 'NgRx demo setup App',
  }),
  EffectsModule.forRoot([]),
  EntityDataModule.forRoot(entityConfig)
],
providers:[
  {
    provide: DefaultDataServiceConfig,
    useValue: {
       root: "https://xxx.xxxx.localhost/",
    }
  }
]

entityConfig.ts :

import {EntityMetadataMap} from '@ngrx/data';

const entityMetadata: EntityMetadataMap = {
  Operation: {},
};

export const entityConfig = {
  entityMetadata
};

My operation-service.ts with NgRx :

import { Injectable } from '@angular/core';
import {EntityCollectionServiceBase, EntityCollectionServiceElementsFactory} from "@ngrx/data";

import {Operation} from "@models/entities/operation.model";

@Injectable({ providedIn: 'root' })
export class NgxOperationService extends EntityCollectionServiceBase<Operation> {
  constructor(serviceElementsFactory: EntityCollectionServiceElementsFactory) {
    super('Operation', serviceElementsFactory);
  }
}

Call in the component :

ngOnInit() {
  this._operationServiceX.getAll()
}

In my network panel in Chrome I see a suspicious call that doing my CORS ERROR : Before it's call http://api.xxxx.localhost/operations/ that doing a redirect to https://api.xxxx.localhost/operations and I don't no why NgRx Data doing this first call to an HTTP that cause my CORS ERROR.

Capture of network panel in chrome

Anyone can help me ?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

This probably isn't caused by ngrx data. Please make sure that you can execute the same request, without using ngrx data.

The server probably needs to accept requests from the angular client.

about 4 years ago · Juan Pablo Isaza Relatório
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