Configuring http headers for source code viewer

Introduction

In some situations you may attempt to view the source code of an object but the source code is never displayed despite the soure code data source being configured correctly and other objects displaying their source code without issue. On further investigation, a “Request header is too large” error is also seen in the sourcodeservice.log file, as follows:

2024-05-15 09:12:13.289  INFO 5200 --- [nio-9980-exec-5] o.apache.coyote.http11.Http11Processor   : Error parsing HTTP request header Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.java.lang.IllegalArgumentException: Request header is too large

This error indicates that CAST Imaging was unable to display the source code because the source code of the object in question is too large and exceeds the size authorized in the API call between the CAST Imaging UI and the back-end database. It is possible to update the authorized file size to allow the source code of larger objects to be displayed. This is described below.

Update process

To resolve this issue, edit the application.properties file located here:

Windows: %APPDATA%\CAST\ImagingSystem\sourcecode\application.propertiesLinux/Docker, in the custom defined install folder: /server/sourcecode/application.properties or /sourcecode/application.properties

Modify the following line to increase the header size to1MB (from the default 40KB) - note that you may need to increase this value further if a value of 1MB does not resolve the error:

server.max-http-header-size=1MB

Save the file and then restart the source code service / Docker container to ensure the changes are taken into account.