Request header is too large

Can we change the TeamCity On-Premises config to allow larger headers?

We are running TeamCity directly, not through an IIS proxy or similar.

The header is large because of cookies from other sites on the same server/domain but different port.

0
15 comments
Hi Daniel,

Could you provide more details on the issue you are facing? What are the symptoms, error messages, etc.?

Best regards,
Anton
0

Hi Anton,

TeamCity fails to show any builds.

The browser network log shows a 400 error.

The TeamCity logs have the error “Request header is too large”.

Kind regards,

Daniel

0
Dear Daniel,

Could you reproduce the issue with the developer tools in the browser open and share the following?
1. teamcity-server.log file.
2. A screenshot of the Console tab.
3. A screenshot of the Network tab after refreshing the page with the "Has blocked cookies" flag on.
4. HAR logs (https://support.zendesk.com/hc/en-us/articles/204410413-Generating-a-HAR-file-for-troubleshooting).
You can upload the above to https://uploads.jetbrains.com/ and share the upload ID.

Additionally, in one of the previous cases, similar behavior was mitigated by clearing the local site data (including cookies); it may be worth a try.

Best regards,
Anton
0

Hi Anton,

As I said in the original post, we know the header is too large because of cookies.

We're not asking for a new feature in TeamCity. We're asking if we can configure Teamcity/Catalina/Tomcat to allow large headers. 

Kind regards,

Daniel

0
Hi Daniel,

Sorry, I didn't read it as the large header size is expected.
You can find the maxHttpHeaderSize property in <Connector> in <TeamCity home>/conf/server.xml file. It is in bytes.
Please try increasing it and restart the server afterward. Please let me know the results.

Best regards,
Anton
0

Hi Anton,

Despite setting to 20,000, still getting Request Header Too Large. This was the only uncommented connector in server.xml, but the port doesn't match the actual front end port. Am I missing something?

    <Connector port="7042" protocol="org.apache.coyote.http11.Http11NioProtocol"
               connectionTimeout="60000"
               redirectPort="8543"
               useBodyEncodingForURI="true"
               tcpNoDelay="1"
               maxHttpHeaderSize="20000"
    />

Kind regards,

Daniel

0
Dear Daniel,

Did you restart the server afterward? The default value in server.xml shipped with TeamCity is 16000. Are you sure that an additional 4000 is enough in your case? Could you try 65536 (64 KB) and tell me the results?
The port difference could be due to HTTPS settings. It doesn't affect what connector Tomcat uses after HTTPS redirect.

Best regards,
Anton
0

Hi Anton,

I did restart the service after setting the value. 16000 should be enough. According to the dev tools, the failing requests have about 8.5kb in request headers. Still want me to try 65536?

Kind regards,

Daniel

0
Dear Daniel,

Could you try it just to check it? I'm looking at other possibilities at the moment.
And please confirm if you have the HTTPS set up.

Best regards,
Anton
0

Dear Anton,

Still getting Request header is too large with 65536. If it makes a difference, this error is showing in the catalina.{date}.log file.

We do have HTTPS configured within TeamCity.

Kind regards,

Daniel

0
Dear Daniel,

I have confirmation that the abovementioned maxHttpHeaderSize property should work.
Could you share the teamcity-server.log file and the Catalina log file you mentioned to proceed with the investigation? You can upload the files to https://uploads.jetbrains.com/ and share the upload ID.
Please also share the screenshot of HTTPS settings and Server URL in Global Settings.

Best regards,
Anton
0

Dear Anton,

Logs and screenshots uploaded to service. Upload id: 2024_07_25_y525dPFErGBBfzb8MtDbLZ

Kind regards,

Daniel

0
Dear Daniel,

We discovered that with HTTPS enabled, there is currently no option to set the maximum header size, so it defaults to 8 KB. We created an issue in our tracker to add this functionality: https://youtrack.jetbrains.com/issue/TW-89113. You can subscribe to it to receive updates about further development.

Best regards,
Anton
0

Dear Anton,

Thank you for looking into this.

I can't see the issue you created ( I get a 404 error ) but I did find this issue which looks similar:

https://youtrack.jetbrains.com/issue/TW-71999/Teamcity-502-Bad-Gateway-error-because-of-too-large-cookie-length

Kind regards,

Daniel

0
Dear Daniel,

Sorry, it had wrong access settings, now it should be visible: https://youtrack.jetbrains.com/issue/TW-89113.

Best regards,
Anton
0

Please sign in to leave a comment.