Getting express server to accept CORS request

前端 未结 6 704
陌清茗
陌清茗 2020-12-06 09:42

I have my express server running on http://localhost:3000 (I call this web-server) I have another application running on localhost:8100 (I call this simply \'app\')

6条回答
  •  不思量自难忘°
    2020-12-06 10:33

    I thought I'd had cracked this one before but once I swapped back from IIS to IIS Express, I started to get the error again!!

    Started to Google once again and tried numerous suggestions, including the ones above but none of them worked until I found this article from Melvin's Web Stuff - Enable CORS IIS Express which suggested the following:

    Add the following 2 lines to the section under the section:

    
    
    

    to the applicationhost.config located in:

    %HOMEPATH%\Documents\IISExpress\config
    

    The final result should look like this:

    
       
          
             
             
                
       
       
          
       
    
    

    This worked nicely for me but note that I didn't need the above when running in IIS.

提交回复
热议问题