General Information
Flexible Origin is a web server that can be controlled directly from the client using special request headers called x-fo headers.
It is the best way to reproduce specific responses without having to manipulate weird Apache or Nginx configurations.
This document shows all the x-fo headers available to control the Flexible Origin, you might want to combine them to achieve a specific response, be careful not to step over your own foot (like invoking two actions that modify the body of the response). The user guide is divided into the following sections:

  • X-FO Response Code: explain all the X-FO headers that act over the response status code.
  • X-FO Responde Body: explain all the X-FO headers that act over the response body.
  • X-FO Response Headers: explain all the X-FO headers that act over the response headers.
  • X-FO Action Headers: explain all those actions that don't have to do with response code, body, or headers (eg. Add a delay on the response coming from the origin).
  • Flexible Origin APIs: explain all the APIs available to control other Flexible Origin characteristics (like uploading files, etc.).
  • Other useful information: explain other useful tips you might want to know about Flexible Origin.
We are working on a special Jira space to report bugs or ask for enhancements for any XAP project. In the meantime please send your notes to [email protected] and we will take care.
X-Akamai-Projects (XAP) is a Service Delivery initiative that groups SAs that want to innovate and work on side projects with global impact. XAP is not about individuals is about community. Flexible Origin is one product of this effort. More information here.
X-FO Response Code
Goal Define the response status code
Header name x-fo-statuscode-define
Value syntax { 0,999 }
Example x-fo-statuscode-define: 200
X-FO Response Body
Goal Show the request headers received by the origin
Header name x-fo-body-showrequestheaders
Value syntax { json | plain | html | xml }
Example x-fo-body-showrequestheaders: json
Goal Show the request body received by the origin
Header name x-fo-body-showrequestbody
Value syntax { plain }
Example x-fo-body-showrequestbody: plain
Goal Send relevant information through the response body (request headers received by the origin, origin IP, origin hostname, request method, URL)
Header name x-fo-body-info
Value syntax { json | plain | html | xml | help }
Example x-fo-body-info: json
Goal Return a compressed object in the required format
Header name x-fo-body-compressed
Value syntax { zip | gzip | bzip | deflate | br }
Example x-fo-body-compressed: gzip
Goal Return an image in the selected format
Header name x-fo-body-image
Value syntax { png | gif | jpeg }
Example x-fo-body-image: png
Goal Return a binary random object with the selected size in bytes
Header name x-fo-body-binary
Value syntax { Number_of_bytes }
Example x-fo-body-binary: 20
Goal Return a text based object of the desired format
Header name x-fo-body-text
Value syntax { css | html | js | plain | indexhtml }
Example x-fo-body-text: css
Goal Return selected amount of log lines (the tail of the log file). You can use these log lines to check headers received by the flexible origin and some other information (let us know if you want to see any special information in the logs)
Header name x-fo-body-loglines
Value syntax { Number_of_log_lines }
Example x-fo-body-loglines: 10
X-FO Response Headers
Goal Add a header in the response from origin. You must define a different number for each header you are trying to set
Header name x-fo-header-add-{number}
Value syntax { header_name=header_value }
Example x-fo-header-add-1: Cache-Control=max-age=0s
Goal Add cookie in the response from origin. You must define a different number for each cookie you are trying to set
Header name x-fo-header-addcookie-{number}
Value syntax { cookie }
Example x-fo-header-addcookie-1: thisIsAcookie=IamACookie
Goal Modify a reponse header coming from the origin. You must define a different number for each header you are trying to modify. The 'Server' header can't be modified by the moment. Let us know if this is something you need
Header name x-fo-header-modify-{number}
Value syntax { header_name=header_new_value }
Example x-fo-header-modify-1: Content-Length=1000
X-FO Action Headers
Goal Make the Flexible Origin delay its response by the amount of seconds you need
Header name x-fo-action-delay
Value syntax { time_in_seconds }
Example x-fo-action-delay: 15
Other useful information
Allowed methods Flexible Origin allows the following methods: GET, POST, PUT, DELETE, OPTIONS, and HEAD
Reserved paths Flexible Origin reserves the following paths for internal processing: /static/* and /x-fo/*.
Combined headers All x-fo headers only work over a specific section of the response or over a specific action. This means you might need to combine more than one x-fo header to achieve a goal. For example, if you want to get an image that is displayed in your browser you might want to combine x-fo-body-image and also x-fo-header-add to include 'Content-Type: image/png'. This gives you A LOT of flexibility (that's why it's called Flexible Origin, duh!)