OPTIONS <a class="postlink" href="http://api.myserver.com/AbpUserConfiguration/GetAll">http://api.myserver.com/AbpUserConfiguration/GetAll</a> 502 (Bad Gateway) e @ polyfills.2b2feaf….bundle.js:36 t.scheduleTask @ polyfills.2b2feaf….bundle.js:43 onScheduleTask @ polyfills.2b2feaf….bundle.js:43 t.scheduleTask @ polyfills.2b2feaf….bundle.js:43 n.scheduleTask @ polyfills.2b2feaf….bundle.js:43 n.scheduleMacroTask @ polyfills.2b2feaf….bundle.js:43 (anonymous) @ polyfills.2b2feaf….bundle.js:36 send @ VM1782:3 send @ VM1785:4 ajax @ VM1785:4 a.ajax @ VM1786:2 (anonymous) @ VM1815:20 a.Deferred @ VM1786:2 abp.ajax @ VM1815:19 t.getUserConfiguration @ main.7700ca7….bundle.js:1 (anonymous) @ main.7700ca7….bundle.js:1 (anonymous) @ main.7700ca7….bundle.js:1 i @ VM1785:2 fireWith @ VM1785:2 f.(anonymous function) @ VM1785:2 (anonymous) @ VM1815:25 i @ VM1785:2 fireWith @ VM1785:2 A @ VM1785:4 (anonymous) @ VM1785:4 u @ polyfills.2b2feaf….bundle.js:8 t.invokeTask @ polyfills.2b2feaf….bundle.js:43 onInvokeTask @ vendor.8fd772e….bundle.js:371 t.invokeTask @ polyfills.2b2feaf….bundle.js:43 n.runTask @ polyfills.2b2feaf….bundle.js:43 invoke @ polyfills.2b2feaf….bundle.js:43
client.myserver.com/:1 XMLHttpRequest cannot load <a class="postlink" href="http://api.myserver.com/AbpUserConfiguration/GetAll">http://api.myserver.com/AbpUserConfiguration/GetAll</a>. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://client.myserver.com' is therefore not allowed access. The response had HTTP status code 502.
5 Answer(s)
-
0
Hi @antonis,
I think this is related to allowing CORS in your app. Did you configured addresses for *.Web.Host and angular2 client ?
If so, can you share those values (you can replace them with fake addresses, it will be enough) ?
Thanks.
-
0
This is the appsettings.json of the Web.Host
"App": { "ServerRootAddress": "http://api.mydomain.com/", "ClientRootAddress": "http://app.mydomain.com", "CorsOrigins": "http://app.mydomain.com" },
and the appconfig.json in angular 2 { "remoteServiceBaseUrl": "http://api.mydomain.com", "appBaseUrl": "http://app.mydomain.com" }
-
0
Hi,
Could you try this?
"CorsOrigins": "http://mydomain.com"
-
0
I have tried it but still the same error
-
0
Hi @antonis,
Can you share your real config via email and add a screenshot of your client app ?
Thanks.