Home > Back-end >  HTTP Error 414.0 - URL Too Long. But URL is short
HTTP Error 414.0 - URL Too Long. But URL is short

Time:09-17

I have a JS file which returns a HTTP Error 414.0 - URL Too Long.

The URL isn't particularly long - http://beta.abcdefg.abc.ab/abcdef/abcdefgh.js

I am suspecting that maybe the physical path is too long, but it's only 91 characters - \abcdefsitestorage.file.core.windows.net\iisfarm\Websites\asp\asp-apps\abcdef\abcdefgh.js

(examples are same length and structure of real URL)

I have experimented with settings in the web.config but they have made no difference

<httpRuntime requestValidationMode="2.0" requestPathInvalidCharacters="" maxRequestLength="2147483647" executionTimeout="1200" maxQueryStringLength="2097151" maxUrlLength ="65536" relaxedUrlToFileSystemMapping="true"/>

and

<security>
        <requestFiltering>
          <requestLimits maxUrl ="65536" maxAllowedContentLength="4294967295" maxQueryString ="2097151" />
        </requestFiltering>
      </security>

I've now run out of ideas so if anyone can point me in the right direction that would be great!

Edit:

Confirmed that issue is with IIS. Server response header is Server: Microsoft-IIS/10.0

Currently attempting to get FRT running, it isn't logging anything at the moment.

<system.webServer>
  <tracing>
    <traceFailedRequests>
      <add path="*">
        <traceAreas>
          <add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
          <add provider="WWW Server" areas="Rewrite,Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module" verbosity="Verbose" />
        </traceAreas>
        <failureDefinitions statusCodes="100-900" />
      </add>
    </traceFailedRequests>
  </tracing>
</system.webServer>

Edit 2:

I've been doing some more testing and in this particular location it errors wit 414 for .js, .css and .txt files but it doesn't error with .aspx files.

Is there a separate location that non-aspx files have limits set?

Edit 3:

It is also giving a 414 error even if the target file doesn't exist!

CodePudding user response:

This error is actually thrown from http.sys, not from IIS. The error gets thrown before the request is passed along to IIS in the request-handling pipeline.

To get https.sys to accept longer request URLs without throwing the HTTP 414 error, in the Windows Registry on the server PC, at Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters, create a DWORD-type value with name MaxFieldLength and value sufficiently large, e.g. 65535.

More information you can refer to this link: https://stackoverflow.com/a/34638320/13336642.

CodePudding user response:

I've worked it out.

The 414 error was a complete red herring.

It was a permissions issue with a virtual directory. It was using pass through authentication which seemed to work fine for .aspx pages but not for any other file type.

I have now specified a specific user to connect as and it all works.

  • Related