'Access-Control-Allow-Origin' missing using actix-web

Stuck on this problem where I received this error everytime making POST request to my actix-web server.

CORS header 'Access-Control-Allow-Origin' missing

The post from here is not solving the problem.

my javascript (VueJs running on localhost:3000) :

let data = //some json data
let xhr = new XMLHttpRequest();
xhr.open("POST", "http://localhost:8080/abc");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onload = () => {

My Actix_Web server (running on localhost:8080) :

async fn main() {

    HttpServer::new(move || {
        let cors = Cors::default()
        .allowed_methods(vec!["GET", "POST"])

    .bind(("", 8080))

my cargo.toml dependencies

actix-web = "4"
actix-cors = "0.6.1"

Got any idea?

The XMLHttpRequest API does not add CORS request headers automatically. I'd recommend migrating to the Fetch API and enabling CORS mode on that. See this MDN page.