Error Parsing HTTP Request Header: 3 Ways You Can Fix it

Using the wrong protocol can cause this problem

Reading time icon 2 min. read

Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team Read more

When developing and using Tomcat, you might often encounter Error parsing HTTP request header. This error will prevent your project from running, but it can be fixed.

How can I fix the Error parsing HTTP request header?

Before we start, make sure that your server is configured to handle HTTPS requests. Also, ensure that you’re accessing the server using the right protocol, so try HTTPS instead of HTTP and vice versa.

1. Remove the listener

  1. Open the server.xml file.
  2. Locate the following listener: <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on"/>
    listerner code remove
  3. Remove it and save the changes.
  4. You can also try changing maxHttpHeaderSize by using this code: maxHttpHeaderSize=”1048576″
    maxHttpHeaderSize set

2. Modify

  1. Open the file.
  2. Now add the following lines: trace trace configuration
  3. Save changes.

You can also set the max header size by adding one of the following lines: server.max-http-header-size=64kb server.maxHttpHeaderSize = 102400

This solution works if you’re using SpringBoot.

3. Modify the application.yml file

  1. Open the application.yml file.
  2. Locate the following lines and remove them:
          lazy-initialization: false

    lazy-initiation false configuration

This solution also applies to SpringBoot.

This error message can prevent your application from working correctly, but in most cases, it can be fixed by switching from HTTP or HTTPS or vice versa.

In web development, HTTP errors are fairly common, and we covered HTTP error 431 and HTTP error 413 in previous guides.

Before you go, we also have a guide on HTTP error 302 that might interest you. Did you manage to fix the Error parsing HTTP request header message? Share with us the solution that worked for you.

More about the topics: server