ANZ 8.1.0 angular/.net core
Occasionally my ANZ app works when Published.
I make a small change, and then I get the following message from the client site in the Chrome debug console:
Access to XMLHttpRequest at 'https://myapp-server.azurewebsites.net//AbpUserConfiguration/GetAll?d=1616355221806' from origin 'https://myapp-client.azurewebsites.net' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
The server app is able to display swagger login page. The error persists even after rolling back the change. What might be causing this? How can I diagnose the cause?
13 Answer(s)
-
0
Removing "appsettings.Staging.json" and "appsettings.Development.json" from the server, and making "aspsettings.Production.json" the same as "aspsettings.json" fixed the issue.
Submitted ticket #10212 to suggest a long-term solution.
-
0
'Publish' copies all appsettings.json files to wwwroot. If "CorsOrigins" is not identical for
appsettings.Development.json
andappsettings.Production.json
andappsettings.json
, the CORS error occurs. It appears thatappsettings.Development.json
is still being referenced from somewhere. -
0
Hi @timmackey
If there are some missing values in appsettings.Production.json, some values in appsettings.Development.json might be used. So, you can make sure that both config files contains all the configuration keys.
If that doesn't solve the problem, probably your app is not published in Release mode.