Why does it happen?

There are several reasons for the 421 error, including:

  • Reusing a connection that was previously used to communicate with a different server.

  • Server configuration issues that prevent it from accepting requests from the current client.

  • Incorrect DNS configuration leading to requests being sent to the wrong server.

  • Load balancers or reverse proxies routing requests incorrectly within a network.

# Request example 
curl -X POST https://sandbox.oxylabs.io/ -H 'Accept: application/xml;q=0.9' -H 'Accept-Encoding: br' -H 'User-Agent: AppleWebKit/537.36'

Try Scraper API with 5K results

Common fixes

Methods you can try to remedy the error include:

  • Verify the server configuration to ensure it matches the intended target.

  • Avoid reusing server connections that may be misdirected.

  • Check the DNS settings to ensure requests are routed to the correct server.

  • Implement HTTP/2 server push with care to prevent misdirected requests.

# Response example 
HTTP/1.1 421 Misdirected Request
Content-Type: text/xml; charset=utf-8
Content-Length: 123



421
Misdirected Request

Forget HTTP errors with Scraper API

Web Scraper API

Self-Service

Public data delivery from the majority of websites

From

49

Useful resources

Get the latest news from data gathering world

I'm interested