Abhishek Basavaraj

Akamai unfriendly headers

Blog Post created by Abhishek Basavaraj Employee on Jun 18, 2015

On a daily basis we encounter certain sites where it’s origin server throws 4xx/5xx errors. These errors can be because of many reasons but often we forget to check if origin handles certain headers which can be the reason for these errors.

 

Whenever you see a 4xx/5xx error only on Akamai.

 

First pull up the origin request from fiddler where we see 200 response and use the composer feature in fiddler to execute the request I.e From the origin request construct Akamai request by changing the host header and execute. If it throws an error, this is an indicative of some header that is unfriendly to the origin

 

UNFRIENDLY HEADERS:

 

VIA Header:

 

The Via header, configured in an HTTP profile provides information about each intermediate router that forwards a message. Intermediate routers between a client and an origin web server use the Via header to indicate intermediate protocols and recipients. This information can be used for the following tasks:

 

1) Identifying the intermediate routers that forward messages.

2) Identifying the protocols for intermediate routers.

 

For example, a request message could be sent from an HTTP/1.0 user agent to an internal proxy code-named "fred", which uses HTTP/1.1 to forward the request to a public proxy at nowhere.com, which completes the request by forwarding it to the origin server at www.ics.uci.edu. The request received by www.ics.uci.edu would then have the following Via header field: Via: 1.0 fred, 1.1 nowhere.com (Apache/1.1)

 

Issue: Assuming Origin is capable of compressing object and sending it downstream. When request hits origin with VIA header – Origin doesn’t respond the object with compression enabled - If you encounter this problem - Try to disable edge to Origin compression and remove VIA header

 

<!-- Remove Via From Request -->

<edgeservices:modify-outgoing-request.remove-header>

  <status>on</status>

  <name>Via</name>

</edgeservices:modify-outgoing-request.remove-header>

 

LINK for more info: Beware the Via header and its bandwidth impact on your origin

 

CONNECTION HEADER:

 

When you make requests with "Connection: keep-alive" the subsequent request to the server will use the same TCP connection. This is called HTTP persistent connection. This helps in reduction CPU load on server side and improves latency/response time.

 

Issue: 400 response

Origin 400 responses can be caused by Connection headers. Some origin servers return a 400 response if the request contains multiple Connection: headers. (For example, Connection: TE and Connection: keep-alive.)  If you encounter this problem with an origin server, try removing one of the Connection headers from the forward request.

 

Link for more info: https://docs.akamai.com/esp/user/edgesuite/KnownIssues.html

 

<edgeservices:modify-outgoing-request.remove-header>

  <status>on</status>

  <name>Connection</name>

</edgeservices:modify-outgoing-request.remove-header>

 

<edgeservices:modify-outgoing-request.remove-header>

  <status>on</status>

  <name>TE</name>

</edgeservices:modify-outgoing-request.remove-header>


Just for INFO:

 

Parallel connections: Concurrent HTTP requests across multiple TCP connections

Persistent connections: Reusing TCP connections to eliminate connect/close delays

Pipelined connections: Concurrent HTTP requests across a shared TCP connection

 

Age Header:

 

Issue: If you see Age header being sent by Origin in the response - Ghost reduces the existing TTL values by the age value.

 

<edgeservices:modify-incoming-response.remove-header>

    <name>Age</name>

    <status>on</status>

  </edgeservices:modify-incoming-response.remove-header>

 

VARY Header:


Caching is affected at Akamai servers due to VARY header, VARY header indicates Akamai servers that object may be different based on certain characteristics/headers(Ex: User Agent) and hence object might not be cacheable. Specifically, Akamai will not cache content if the Origin Server response includes a Vary header with a value other than Vary: Accept-Encoding. Akamai will cache responses with Vary: Accept-Encoding only if they are accompanied by Content-Encoding: gzip

 

<edgeservices:modify-incoming-response.remove-header name="pm_remove_vary">

               <name>Vary</name>

               <status>on</status>

</edgeservices:modify-incoming-response.remove-header>

 

OR

 

Add a Behaviour as the below screenshot

 

Screen Shot 2015-06-18 at 10.16.52 PM.png

 

NOTE: Feel free to add your comment if you have any other headers which could cause issues.

Outcomes