Version Affected: All
Overview
A SecureAuth realm gives a 404 error (404.15 - Query String Too Long) when a request's query string or URL is longer than the server allows. This happens most often when a Service Provider (SP) initiates sign-in, or when a client calls the realm's OpenID Connect (OIDC) logout endpoint.
When an SP initiates Security Assertion Markup Language (SAML) authentication by redirect into a SecureAuth realm, the realm can return a 404 error even though browsing to the same realm directly works fine. The Internet Information Services (IIS) log shows the full error code as 404.15 — "The Request Filtering module rejected a request with a too-long query string." This happens because the SP's AuthnRequest, and any other parameters it sends in the redirect, exceed a query string or URL length limit. SecureAuth has seen this triggered by several SPs, including Salesforce1 (whose SAML request is unusually large), Azure and Cloudflare Access.
The same error can occur at a realm's OIDC logout endpoint, OidcEndSession.aspx, when the client passes the user's ID token in the id_token_hint parameter. A signed ID token can be over 2,000 characters on its own, which is enough to take the query string past the default limit of 2,048 characters. The browser then shows a page-not-found error for https://<idp-host>/<realm>/OidcEndSession.aspx?client_id=....
This error has two independent causes, and both may need to be checked. Each cause listed below gives the symptom that identifies it.
These causes are not related, so raising one limit will not fix the other if it's also too low.
On an Identity Provider (IdP) hosted by SecureAuth in the cloud, both limits are set on SecureAuth's servers. Open a support case with the realm and the length the request needs, and SecureAuth Support raises them.
In this article
-
Cause 1: The IIS Request Filtering Limit Is Too Low
IIS rejects the request before it reaches the realm and logs error 404.15.
-
Cause 2: The .NET httpRuntime Limit Is Too Low
The 404 error continues after the IIS limit in Cause 1 has been raised.
Cause 1: The IIS Request Filtering Limit Is Too Low
IIS's Request Filtering module enforces its own maximum query string and URL length (system.webServer/security/requestFiltering), independent of anything in the realm's own web.config. If an SP's request exceeds this limit, IIS rejects it before it ever reaches the SecureAuth application, logging error 404.15.
To resolve this:
- Open IIS Manager.
- Navigate to the Default Web Site (or a specific realm, if you want to scope the change to just that realm).
- In the Features View, click Configuration Editor.
- Change the Section to system.webServer/security/requestFiltering.
- Expand requestLimits and increase maxQueryString to 4096 and maxUrl to 8192.
- Apply the changes.
- Repeat the change on any other IdPs.
Cause 2: The .NET httpRuntime Limit Is Too Low
Separately from IIS's Request Filtering module, the httpRuntime element in the realm's own web.config enforces its own maxQueryStringLength and maxUrlLength. Even after the IIS-level limit in Cause 1 is raised, the same 404 error can still occur if this separate .NET-level limit hasn't also been raised.
To resolve this:
- Open the SecureAuth Admin Console and log in, then click Go to Advanced Settings.
- Click Admin Realm.
- Select the realm having the issue from the realm list, then click the System Info tab.
- Click Decrypt.
- Open File Explorer and browse to D:\SecureAuth\SecureAuthXXX, where XXX is the number of the realm having the issue.
- Open web.config in Notepad or your usual text editor.
-
Find the httpRuntime element and add or increase maxQueryStringLength to at least the value set in Cause 1:
<httpRuntime enableVersionHeader="false" requestValidationMode="2.0" targetFramework="4.7.2" maxQueryStringLength="4096" /> -
If the issue isn't resolved, also add maxUrlLength:
<httpRuntime enableVersionHeader="false" requestValidationMode="2.0" targetFramework="4.7.2" maxUrlLength="8192" maxQueryStringLength="4096" /> - Test that the realm is working properly again.
Special Considerations
It's best practice to keep these limits as small as possible to reduce the attack surface for injection attacks. If you can get the SP or app vendor to reduce the size of their request instead, that's the better approach.
SecureAuth Knowledge Base Articles provide information based on specific use cases and may not apply to all appliances or configurations. Be advised that these instructions could cause harm to the environment if not followed correctly or if they do not apply to the current use case.
Customers are responsible for their own due diligence prior to utilizing this information and agree that SecureAuth is not liable for any issues caused by misconfiguration directly or indirectly related to SecureAuth products.
Comments
0 comments
Please sign in to leave a comment.