Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

92
Views
NgRx hace una redirección extraña a HTTP antes de ir a HTTPS que causa un ERROR DE CORS

Soy nuevo con ngrx y quiero usar el módulo de datos NgRx. Estoy en una pila con Angular/Symfony alojado en docker con Traefik (modo https).

Quiero hacer una solicitud a una ruta llamada: https://xxx.xxxxxx.localhost/operations Esta ruta normalmente me envía mi lista de operaciones con uso estándar con el servicio angular.

Pero con el módulo de datos NgRx cuando llamé a esta ruta, tengo un ERROR DE CORS.

Configuración NgRx:

Importar y configurar mi dirección de punto final personalizada en 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/", } } ]

entidadConfig.ts:

 import {EntityMetadataMap} from '@ngrx/data'; const entityMetadata: EntityMetadataMap = { Operation: {}, }; export const entityConfig = { entityMetadata };

Mi operación-servicio.ts con 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); } }

Llame al componente:

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

En mi panel de red en Chrome veo una llamada sospechosa que está haciendo mi CORS ERROR: antes de llamar a http://api.xxxx.localhost/operations/ que está haciendo una redirección a https://api.xxxx.localhost/operations y yo No sé por qué NgRx Data hace esta primera llamada a un HTTP que causa mi CORS ERROR.

Captura de panel de red en cromo

Alguien puede ayudarme ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Esto probablemente no sea causado por los datos de ngrx. Asegúrese de que puede ejecutar la misma solicitud, sin usar datos ngrx.

El servidor probablemente necesite aceptar solicitudes del cliente angular.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!