Skip to content
Pinter Computing

Knowledge Base for IT Professionals, Teachers, and Astronauts

Pinter Computing

Knowledge Base for IT Professionals, Teachers, and Astronauts

  • Home
  • Programming
  • DevOps
  • Project Management
  • Software and Hardware
  • Miscellaneous
  • Egyebek
  • About
  • Experience
  • Education
  • Contact
  • Home
  • Programming
  • DevOps
  • Project Management
  • Software and Hardware
  • Miscellaneous
  • Egyebek
  • About
  • Experience
  • Education
  • Contact
Close

Search

Home/Knowledge Base/has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource
Knowledge Base

has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource

By Laszlo Pinter
May 4, 2020 1 Min Read
0

When your website calls the Socket.IO backend API from another domain, the browser console displays the error message

Access to XMLHttpRequest at ‘http://…:3000/socket.io/?EIO=3&transport=polling&t=N7Y-Fot’ from origin ‘http://….com’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

To enable Cross-origin resource sharing add the code to the top of your Socket.IO server.js file

const server = require('express')();

// require 'cors'
const cors = require('cors')
// Add CORS before any other routing
server.use(cors());

const http = require('http').createServer(server);
const io = require('socket.io')(http);

Before building the application install the cors package

npm install cors

Tags:

Node.jsSocket.IO
Author

Laszlo Pinter

Follow Me
Other Articles
Previous

Uncaught TypeError: _helpers_formUtil__WEBPACK_IMPORTED_MODULE_6___default.a is not a constructor

Next

Attach an AWS EBS volume to a Linux server

No Comment! Be the first one.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Last Changes

  • Building Happy, the AI hardware robot November 12, 2026
  • Happy, the AI hardware robot – speech to text November 12, 2026
  • Happy, the AI hardware robot - the touch - metal plate November 11, 2026
  • Happy, the AI hardware robot – the neck – servo motor November 11, 2026
  • Happy, the AI hardware robot - the ears - microphone November 11, 2026

Tags

.NET .NETcore 3Dprinting AI AWS C# Chef cloud DevOps Docker EntityFramework Games Git Go iOS iPad iPhone iPod Java Kubernetes Linux MacOSX MSSQL MVC MySql Node.js Packer PowerShell Python RDS Ruby security Splunk storage TeamCity Terraform TestKitchen Tomcat Ubuntu Vagrant VirtualBox VisualStudio Windows WordPress Xcode

Recent Comments

  • Laszlo Pinter on Turn off the built in touchpad when a mouse is attached
  • Kenneth Bush on Turn off the built in touchpad when a mouse is attached
  • Zengei László on MyHeritage családfa exportálása és küldése emailben
  • Raúl Castillo on DynDns update error
  • MICHAEL on Windows Media Player 12 cannot find the album information

–

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Copyright 2026 — Pinter Computing. All rights reserved.