LiteSpeed WebServer 上的 MIME 类型(“text/html”)不匹配(X-Content-Type-Options:nosniff)

问题描述 投票:0回答:1

不知道如何解决这个问题,它基本上会引发 React 应用程序构建 css/js 引用文件的错误。 可以查看https://eliptum.tech/dev/

来自浏览器开发工具控制台:

The resource from “https://eliptum.tech/dev/static/css/main.d4db63ae.css” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
The resource from “https://eliptum.tech/dev/static/js/main.3d9e49c0.js” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).

这是网络应用程序的代码: https://github.com/itsMGA/eliptum-react

对于htaccess

cat .htaccess
DirectoryIndex eliptum/index.html
# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION BEGIN
PassengerAppRoot "/home/eliptumr/developement"
PassengerBaseURI "/dev"
PassengerNodejs "/home/eliptumr/nodevenv/developement/20/bin/node"
PassengerAppType node
PassengerStartupFile  ../../developement/eliptum-react/src/App.js
# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION END
AddType text/css .css
AddType application/javascript .js


包.json


{
  "name": "react",
  "version": "0.0.0",
  "private": true,
  "homepage": "./",
  "dependencies": {
    "prop-types": "^15.8.1",
    "react": "^18.1.0",
    "react-dom": "^18.1.0",
    "react-scripts": "latest"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "BUILD_PATH='/home/eliptumr/public_html/dev/eliptum' react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },
  "devDependencies": {
    "react-scripts": "latest"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

Webhost 使用 liteSpeed 沙箱(通过沙箱它确实有效,我将其留在这里以防万一): https://codesandbox.io/p/github/itsMGA/eliptum-react/main?workspaceId=f67c34c4-4b2d-408b-92e8-b07b2e0f9257

javascript reactjs linux apache litespeed
1个回答
0
投票

此问题已发布在 LiteSpeed Slack 上,并且该问题的修复也发布在那里。错误是由于服务器配置错误引起的,与 LiteSpeed 无关。

© www.soinside.com 2019 - 2024. All rights reserved.