NGRX在转到HTTPS之前将怪异的重定向重定向到HTTP
我是NGRX的新手,我想使用NGRX数据模块。我与Traefik(HTTPS模式)在Docker中托管的Angular/Symfony堆叠在一起。
我想向名为: https://xxx.xxxxxxxxx x.localhost/operations ) 这条路线通常会给我发送带有Angular Service标准用法的操作列表。
但是使用NGRX数据模块时,我称此路线时会有一个CORS错误。
ngrx配置:
exp.module.ts中的我的自定义端点adress:
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/",
}
}
]
extityconfig.ts:
import {EntityMetadataMap} from '@ngrx/data';
const entityMetadata: EntityMetadataMap = {
Operation: {},
};
export const entityConfig = {
entityMetadata
};
我的操作 - 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);
}
}
在组件中致电:
ngOnInit() {
this._operationServiceX.getAll()
}
在chrome的网络面板中,我看到一个可疑调用,我看到一个可疑的呼叫CORS错误: 在调用之前a href =“ https://api.xxxx.localhost/operations” rel =“ nofollow noreferrer”> https://api.xxxx.localhost/operations/aperations ,我没有第一次ngrx数据。致电导致我的CORS错误的HTTP。
任何人都可以帮助我吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能不是由NGRX数据引起的。
请确保您可以执行相同的请求,而无需使用NGRX数据。
服务器可能需要接受Angular客户端的请求。
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.