0

I can't find a way to figure out where is the host name configuration provided for the SPA application to connect to.

The command passed into the application from ASP.NET Core server while running the SPA is

ng serve --port 44472 --ssl --ssl-cert %APPDATA%\ASP.NET\https\%npm_package_name%.pem --ssl-key %APPDATA%\ASP.NET\https\%npm_package_name%.key

And I could not find any of the above strings localhost:7219, or 5219, or 7219 in the ClientApp / ClientApp/src folder (7219 and 5219 are the server ports and 44472 is the client npm port).

Do the server URLs passed from launchSettings.json asp project directly?

If so, if there a way to configure the server URLs directly from ClientApp if the client application is run from a different host, other than localhost (any where the settings (are | should be) stored)?

I can see the @Injected service everywhere but where does it store the settings is unclear (for how to configure this injected BASE_URL?):

  constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string) {
    http.get<WeatherForecast[]>(baseUrl + 'weatherforecast').subscribe((result : any) => {
      this.forecasts = result;
    }, (error : any) => console.error(error));
  }

The derived question is: should by default the client Bearer authorization also work for a remote host?

The remote host for example is github pages. How to properly set the remote host configuration within client application for a particular webpack deployment with angular-cli-ghpages if the CORS hosts are configured within Program.cs? Should the client configuration for a remote host (apart from localhost) or server CORS configuration, include additional "Bearer-Cors" configuration (as for the certificate npm start script mentioned in the question above – should it be just skipped without any parameters passed in it)?

Are there any comprehensive guidelines on this subject?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Ivan Silkin
  • 381
  • 1
  • 7
  • 15

1 Answers1

0

Half of the answer to this question is that the template uses proxy config, which is described here https://angular.io/guide/build#proxying-to-a-backend-server and stores the configuration in proxy.conf.js within ClientApp folder. I will try to extend my answer with any found information in the future.

Update: The second part of the answer is to add the Cookie.SameSite = SameSiteMode.None; cookie authorization configuration in Startup.cs / Program.cs. Take a look at the solution: https://stackoverflow.com/a/75239406/6897369

Ivan Silkin
  • 381
  • 1
  • 7
  • 15