CI4.0.3 Error CORS ON GET |
I am using REST API but much problems with CORS in apache + ubuntu 16.0.4.
I have errors CORS when my application (AngularJS) try to do the GET and don't have the '?' on end of URL. Example: GET api.xxx:8080/controller?/ Anybody have solution to this? My APP.php public $uriProtocol = 'REQUEST_URI'; public $indexPage = ''; My .htaccess Code: # Disable directory browsing
We were having similar issue while using Nuxt(VueJs) framework. Apparently it was resolved by doing proxy config in the Nuxt app itself. So probably you need to similarly apply proxy config for calling cross domain apis from your Angular app, nothing much is required on CI end I guess.
I need create one proxy? Or only change any config in CI.
I am developer and never config one proxy.
Hello,
I have followed what you have mentioned that this CORS issue is resolved by angular proxy, I have created a simple proxy and giving me the below error: Code: [HPM] Error occurred while trying to proxy request /api/v1/login from localhost:4200 to http://localhost:8080 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors) In browser console: Code: Backend returned code 504, body was: Error occured while trying to proxy to: localhost:4200/api/v1/login Where Code: ECONNREFUSED (Connection refused): No connection could be made because the target machine actively refused it. This usually results from trying to connect to a service that is inactive on the foreign host. And here is the proxy: Code: { Any idea whats wrong with that? |
Welcome Guest, Not a member yet? Register Sign In |