# The issue of CORS cross domain access

**URL:** <https://forum.metasfresh.org/t/the-issue-of-cors-cross-domain-access/2233>\
**Category:** Uncategorized\
**Created:** [February 28, 2024, 8:50am UTC](https://forum.metasfresh.org/t/the-issue-of-cors-cross-domain-access/2233 "2024-02-28T08:50:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lihuaien](https://forum.metasfresh.org/user_avatar/forum.metasfresh.org/lihuaien/32/956_2.png) [@lihuaien](https://forum.metasfresh.org/u/lihuaien)\
**Post date:** [February 28, 2024, 8:50am UTC](https://forum.metasfresh.org/t/the-issue-of-cors-cross-domain-access/2233/1 "2024-02-28T08:50:58Z")

</div>

Hello experts and friends, the cross domain access code for CORS has already been configured in webpackconfig.js. Why is it still showing that cross domain access is not possible? Can the meatsfresh project not run locally? I have set the following code in the Cors plugin environment:  
const axios =require(‘axios’);  
axios.defaults.baseURL = ‘[http://127.0.0.1:8081](http://127.0.0.1:8081)’; //Set the base URL for the request  
axios.defaults.headers.common[‘Access-Control-Allow-Origin’] = ‘[http://127.0.0.1:8081](http://127.0.0.1:8081)’; // Set source addresses that allow cross domain access  
axios.defaults.headers.common[‘Access-Control-Allow-Methods’] = ‘PUT,POST,GET,DELETE,OPTIONS’; // Set allowed request methods  
axios.defaults.headers.common[‘Access-Control-Allow-Headers’] = ‘Content-Type, client, devicesid, registersign’;  
axios.defaults.withCredentials=true;  
At the same time, I also set up：  
const express = require(‘express’);  
const cors = require(‘cors’);  
const app = express();  
const corsOptions = {  
origin: true, // Allowing access to source addresses  
methods: ‘PUT,POST,GET,DELETE,OPTIONS’, // HTTP methods allowed  
allowedHeaders: [‘Content-Type, client, devicesid, registersign’], // Allow request headers  
credentials:true  
};  
// Using Cors middleware  
app.use(cors(corsOptions));

**Why do cross domain errors always occur in images** ：

 ![231231](https://forum.metasfresh.org/uploads/default/original/1X/9b68d3350a769f3e98fb9c9718a54c552859f9e0.jpeg)

---

<div class="post-metadata">

**Author:** ![lihuaien](https://forum.metasfresh.org/user_avatar/forum.metasfresh.org/lihuaien/32/956_2.png) [@lihuaien](https://forum.metasfresh.org/u/lihuaien)\
**Post date:** [March 6, 2024, 10:18am UTC](https://forum.metasfresh.org/t/the-issue-of-cors-cross-domain-access/2233/2 "2024-03-06T10:18:44Z")

</div>

have already been solved！
