Base solution for your next web application
Open Closed

Publish to production fails with the following errors #3236


User avatar
0
antonis created

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)
  • User Avatar
    0
    ismcagdas created
    Support Team

    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.

  • User Avatar
    0
    antonis created

    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" }

  • User Avatar
    0
    alirizaadiyahsi created

    Hi,

    Could you try this?

    "CorsOrigins": "http://mydomain.com"
    
  • User Avatar
    0
    antonis created

    I have tried it but still the same error

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @antonis,

    Can you share your real config via email and add a screenshot of your client app ?

    Thanks.