lundi 11 mai 2020

HTTP Error 500.1013 Azure App Service Node 8.9.4

We have used the Azure App Service on Linux/Docker to host our Node.js app, We have an error 500.1013 while sending more than 240MB files in Request Body. (Node exe is crashed).

but it's working fine in development, We have faced this error only in production.

Web.config

<configuration>
  <system.webServer>
    <handlers>
      <clear />
      <add name="iisnode" path="app.js" verb="*" modules="iisnode" />
    </handlers>
    <httpErrors existingResponse="PassThrough" />
    <httpProtocol>
      <customHeaders>
        <remove name="X-Powered-By" />
      </customHeaders>
    </httpProtocol>
    <iisnode enableXFF="true" maxRequestBufferSize="52428800" loggingEnabled="true" />
    <rewrite>
      <rules>
        <rule name="Node app">
          <match url="/*" />
          <action type="Rewrite" url="app.js" />
        </rule>
      </rules>
    </rewrite>
    <security>
      <requestFiltering removeServerHeader="true">
        <requestLimits maxAllowedContentLength="2097152000" />
      </requestFiltering>
   </security>
   <webSocket enabled="false" />
  </system.webServer>
</configuration>

App.js (proxy)

 config.get("apiBase"),
 {
   limit: "2gb",
   proxyReqOptDecorator: (proxyReqOpts, srcReq) => {

     const headerNames = Object.keys(proxyReqOpts.headers);
     headerNames.forEach(h => {
       if (h.startsWith("x-forwarded-")) {
         delete proxyReqOpts.headers[h];
       }
     });

     return proxyReqOpts;
   },
   proxyReqPathResolver: req => "/" + (req.path.substring(`/${apiProxyPathPrefix}/`.length) + "?" + (url.parse(req.url).query || ''))
 }); ```





Aucun commentaire:

Enregistrer un commentaire