I have some problems with IIS when using IIS for the React remix application.
I use npm run build to use the application in production and npm start, and in the IIS use the reverse proxy when using the IIS URL in the browser to return to my application but the CSS styles are not in my application. This is my web.config
<? xml version = "1.0" encoding = "UTF-8" ?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://localhost:54058/{R:1}" />
</rule>
</rules>
</rewrite>
<defaultDocument>
<files>
<add value="root.jsx" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
and this is my package.json
{
"name": "reporteempleados",
"private": true,
"sideEffects": false,
"type": "module",
"scripts": {
"build": "remix build",
"dev": "remix dev --manual",
"start": "remix-serve ./build/index.js"
},
"dependencies": {
"@remix-run/css-bundle": "^2.0.0",
"@remix-run/node": "^2.0.0",
"@remix-run/react": "^2.0.0",
"@remix-run/serve": "^2.0.0",
"axios": "^1.5.0",
"dotenv": "^16.3.1",
"isbot": "^3.6.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-dotenv": "^0.1.3",
"react-hot-toast": "^2.4.1",
"sweetalert2": "^11.7.28"
},
"devDependencies": {
"@remix-run/dev": "^2.0.0",
"@remix-run/eslint-config": "^2.0.0",
"eslint": "^8.38.0"
},
"engines": {
"node": ">=18.0.0"
}
}
This is the error that is shown in the console of the browser
Failed to load resource: the server responded with a status of 404
I would like to solve my problem and see the CSS styles in my application
I think the browser can't find the CSS files, which may be due to the way you've configured IIS or the paths in your application. In your package.json file, check the "homepage" field. It should be set to the base URL where your application is hosted.