add http-server part 7.9.11 CORS
This commit is contained in:
parent
69f5b0c68b
commit
9c6d71fbc7
1 changed files with 3 additions and 3 deletions
|
@ -5,9 +5,9 @@ import { executeCommand } from './broker.js';
|
||||||
const app = express();
|
const app = express();
|
||||||
const port = 8090;
|
const port = 8090;
|
||||||
|
|
||||||
//app.use(cors());
|
app.use(cors());
|
||||||
// CORS aktivieren und den Origin explizit setzen
|
// CORS aktivieren und den Origin explizit setzen
|
||||||
app.use(cors({
|
/*app.use(cors({
|
||||||
//origin: 'http://localhost:8080', // Erlaubt Anfragen vom Frontend (localhost:8080)
|
//origin: 'http://localhost:8080', // Erlaubt Anfragen vom Frontend (localhost:8080)
|
||||||
origin: 'http://127.0.0.1:8080',
|
origin: 'http://127.0.0.1:8080',
|
||||||
//origin: 'https://192-168-197-2.c-one-infra.de',
|
//origin: 'https://192-168-197-2.c-one-infra.de',
|
||||||
|
@ -20,7 +20,7 @@ app.use(cors({
|
||||||
app.options('/api/command', cors()); // für eine bestimmte Route
|
app.options('/api/command', cors()); // für eine bestimmte Route
|
||||||
|
|
||||||
// Verwende die Middleware, um POST-Body als JSON zu lesen
|
// Verwende die Middleware, um POST-Body als JSON zu lesen
|
||||||
app.use(express.json());
|
app.use(express.json());*/
|
||||||
|
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
console.log('CORS headers set');
|
console.log('CORS headers set');
|
||||||
|
|
Loading…
Reference in a new issue