Coding⏱️ 2 min read📅 2026-05-30

How to Fix: "Cross origin requests are only supported for HTTP." error when loading a local file

Three.js JSONLoader loads local files via file system API, which is not cross-origin by design.

Quick Answer: Use a local server to serve the 3D model file, or use a URL that points to a local file accessible via CORS.

Cross origin requests are only supported for HTTP. When loading a local file, this error can be frustrating, especially when trying to load a 3D model into Three.js using JSONLoader.

🔍 Why This Happens

  • [Cause]

🔧 Proven Troubleshooting Steps

Method 1: Serving Locally with a Web Server

  1. Step 1: Set up a local web server using Node.js and Express, or use a built-in server like Python's http.server.

Method 2: Using a Local Development Server

  1. Step 1: Use a local development server like Three.js's own built-in server, or use tools like LiveServer in Visual Studio Code.

🎯 Final Words

By implementing one of these methods, you should be able to load your local 3D model into Three.js without encountering the 'Cross origin requests are only supported for HTTP' error.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions