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

88
Views
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 answers
Answer question

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 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!