I created my project with Angular 9, I uploaded the server side to two hosts, I send the request to the Windows host and everything is OK, but when I send the request to the Linux host, with the following error Encounters.
Access to XMLHttpRequest at 'https://exam.com/api/Uni/GetAll' from origin 'http: // localhost: 4200' has been blocked by CORS policy: Response to preflight request does not pass access control check : It does not have HTTP ok status.
What could be the problem? Do I have to make changes to the hosting settings, either on the server side or in Angular?
By the way, with my post that I send the request, it is OK, but with the Angular project.
@NgModule({
declarations: [
AppComponent, HomeComponent, NewsComponent, MainAdminComponent, PageNotFoundComponentو...
],
imports: [
BrowserModule.withServerTransition({ appId: 'serverApp' }), AppRoutingModule, FormsModule, BrowserAnimationsModule, ReactiveFormsModule,
HttpClientModule, OwlModule, RichTextEditorAllModule, DialogModule,...
],
providers: [
{ provide: DateAdapter, useClass: MaterialPersianDateAdapter, deps: [MAT_DATE_LOCALE] },
{ provide: MAT_DATE_FORMATS, useValue: PERSIAN_DATE_FORMATS },
{provide:LocationStrategy,useClass:HashLocationStrategy}
],
bootstrap: [AppComponent]
})