VueJS: 'Access-Control-Allow-Origin' header has a value that is not equal to the supplied origin

Viewed 574

The 'Access-Control-Allow-Origin' header has a value of 'https://tttkyle.vn:8086' which is not equal to the original value provided. I'm having a recurring problem. but I can't figure out how to solve it. I have font-end ( VueJS ) running on domain: https://tttkyle.vn and back-end ( Spring-boot ) running on domain: https://tttkyle.vn:8086 when the font-end calls to the back-end's API, it results in an error.

Access to XMLHttpRequest at 'https://tttkyle.vn:8086/KPI/login' from origin 'https://tttkyle.vn has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header has a value 'https://kpi.mobifone5.vn:8086' that is not equal to the supplied origin.

the problem only occurs when i use TLS 1.2 certificate for https and with TLS 1.1 everything goes without error. In VueJS, I add or create a vue.config.js file with:

module.exports = {
   configureWebpack: {
     devServer: {
       headers: { 'Access-Control-Allow-Origin': '*' }
     }
   }
}

or

module.exports = {
   devServer: {
     proxy: 'https://tttkyle.vn:8086'
   }
}

But the problem is still not solved. Note: I tried running with other front-end with no error, only with VueJS error

0 Answers
Related