I tried every solutions, but none of them worked.
My nodejs website is hosted on windows IIS, with iisnode, everything was fine until today.
Also there is something instresting. Lets asume that my domain is cdn1.site.com that gets this error. I create new IIS website, with same physical path, but different domain name: cdn2.site.com
Same request get error on cdn1.site.com, but not on cdn2.site.com !!
What's the problem with first domain !?
Domains use SSL that creates with Let's Encrypt
Main part of server.js :
var app = express();
const server = http.createServer(app);
function shouldCompress (req, res) {
if (req.headers['x-no-compression']) {
return false
}
return compression.filter(req, res)
}
app.use(compression({filter: shouldCompress}))
app.use(requestIp.mw());
app.use(helmet());
app.use(express.json({limit: '50mb'}));
app.use(express.text({limit: '50mb'}));
app.use(express.urlencoded({limit: '50mb', extended: true}));
app.use(cookieParser());
server.listen(process.env.PORT || 2000);
Web.config :
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS" />
<add name="Access-Control-Allow-Headers" value="Origin, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, X-Response-Time, X-PINGOTHER, X-CSRF-Token, csrfToken, $mt-oot-ti-kcuf, $mt-ti-kcu" />
</customHeaders>
</httpProtocol>
<iisnode enableXFF="true" nodeProcessCommandLine="C:\Program Files\nodejs\node.exe --trace-deprecation" />
<httpErrors existingResponse="PassThrough" />
<handlers>
<add name="iisnode" path="server.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="LogFile" patternSyntax="ECMAScript" stopProcessing="true">
<match url="iisnode" />
</rule>
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^server.js\/debug[\/]?" />
</rule>
<rule name="StaticContent">
<action type="Rewrite" url="public{{REQUEST_URI}}" />
</rule>
<rule name="DynamicContent">
<conditions>
<add input="{{REQUEST_FILENAME}}" matchType="IsFile" negate="True" />
</conditions>
<action type="Rewrite" url="server.js" />
</rule>
</rules>
</rewrite>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
</system.webServer>
</configuration>