sqaservices origin simulator — feature reference

A configurable HTTP origin for end-to-end testing of Akamai CDN / Edge Delivery features behind the edge — generic purpose, not tied to any one product. Behavior is driven per-request via the path and request headers, plus a few endpoints that store content/config the mirror then serves. Every mirror response carries an X-sqaservices-version header (the deployed build, shown on the home page).

1. Mirror — status & body

{GET|POST|PUT|PATCH|DELETE} /production/mirror/{anyPath}/{statusCode} returns HTTP {statusCode} with a JSON body { path, receiveTime (epoch ms), incomingHeaders }. If a custom response body/code has been stored (§5) it takes precedence over the default JSON / path status.

curl -i http://HOST/production/mirror/demo/200
curl -i http://HOST/production/mirror/demo/503

2. Origin response headers — Return-<Header>

Any request header Return-<Name>: <value> is echoed back as response header <Name>: <value> — drives edge caching from the origin (honor-origin, downstream lifetime, etc.). Works on both the REST mirror and the /graphql path.

curl -i -H 'Return-Cache-Control: max-age=120' http://HOST/production/mirror/demo/200
curl -i -H 'Return-Expires: Wed, 21 Oct 2099 07:28:00 GMT' http://HOST/production/mirror/demo/200

3. Status override — Return-response-code

Request header Return-response-code: <code> overrides the path {statusCode} on the same URL (edge cache key unchanged). Used for preserveStale / serveStale tests: warm a cacheable 200, then re-issue the same URL forcing a 5xx. Not echoed back as a header.

curl -i -H 'Return-response-code: 503' http://HOST/production/mirror/demo/200   # -> HTTP 503

4. Request recorder — GET /recorder/requests

Rolling window (last 5000) of the mirror requests the origin actually received — correlate what truly reached the origin (a cache MISS / stale-while-revalidate refetch) vs what the edge served from cache. Params: pathContains, sinceMs.

curl 'http://HOST/recorder/requests?pathContains=demo&sinceMs=0'
# -> [ { "receiveTimeMs": .., "method": "GET", "path": "/production/mirror/demo/200?b=1", "status": 200 } ]

5. Stored custom response — /custom-response (PUT → GET → reset)

Store a body/status the mirror then serves globally, plus the tapioca (DBattery) mock body/code/delay. PUT to set, GET to read back, GET .../reset to clear. (Global server state — reset after use.)

curl -X PUT --data 'custom body'  http://HOST/custom-response/body          ;  curl http://HOST/custom-response/body
curl -X PUT --data '418'          http://HOST/custom-response/code          ;  curl http://HOST/custom-response/code
curl http://HOST/custom-response/body/reset ; curl http://HOST/custom-response/code/reset
curl -X PUT --data '<xml/>'      http://HOST/custom-response/tapioca/body   ;  curl http://HOST/custom-response/tapioca/body
curl -X PUT --data '503'          http://HOST/custom-response/tapioca/code   ;  curl http://HOST/custom-response/tapioca/code
curl -X PUT --data '2'            http://HOST/custom-response/tapioca/delay  ;  curl http://HOST/custom-response/tapioca/delay
#   .../tapioca/{body,code,delay}/reset to restore defaults

6. Stored content blobs — /swagger (PUT → GET, by id)

Store arbitrary content (e.g. a swagger/OpenAPI doc) and fetch it back. PUT /swagger/{id} stores under {id}; GET /swagger/{id} returns it. PUT /swagger (no id) / GET /swagger use the last/most-recent blob. Bounded to the 200 most recent ids.

curl -X PUT --data 'my-openapi-doc' http://HOST/swagger/my-api ;  curl http://HOST/swagger/my-api
curl -X PUT --data 'latest'         http://HOST/swagger       ;  curl http://HOST/swagger

7. Volatile mirror resources — /volatile-api/v1/mirror/resource{0,1,2}

Each resource accepts ALL methods (GET/PUT/PATCH/POST/DELETE/HEAD/OPTIONS/TRACE) and mirrors the request (incoming headers, and the body for body-carrying methods). A read-only header echo is also at /volatile-control-api/v1/mirror/{get,resource1-get,resource2-get}.

curl http://HOST/volatile-api/v1/mirror/resource0
curl -X PUT -H 'Content-Type: application/json' --data '{"k":"v"}' http://HOST/volatile-api/v1/mirror/resource0

8. Compression & delay

X-do-gzip request header → gzip-encoded response (Content-Encoding: gzip). X-delay request header → delays the response by the configured tapioca delay (§5).

9. DBattery / tapioca mock — Accept: application/octet-stream

With Accept: application/octet-stream the mirror path returns the Data-Battery / tapioca mock body (Server: dbattery/...) — body/status/delay configurable via §5's /custom-response/tapioca/*.

10. GraphQL — POST /graphql

Queries reflectRequest(traceId): ReqData (echoes receiveTime, the Return-* headers, a per-traceId counter) and traceIdCounter(traceId); mutation resetTraceIds(dry).

curl -i -H 'Content-Type: application/json' -d '{"query":"{ reflectRequest { receiveTime traceIdCounter } }"}' http://HOST/graphql

11. JWKS — GET /.well-known/jwks1.json (HTTPS profile)

Serves JSON Web Key Sets for JWT-validation tests (available on the https deployment).