Skip to content

Instantly share code, notes, and snippets.

@trondhindenes
Created April 29, 2018 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trondhindenes/c20ade1fc34ce32da98a68e0db978c5c to your computer and use it in GitHub Desktop.
Save trondhindenes/c20ade1fc34ce32da98a68e0db978c5c to your computer and use it in GitHub Desktop.
- name: Replay GETs against staging #arbitrary name
methods: #only replay these requests
- get
paths: #replay these paths (use wildcard-notation because I suck at regex)
- "/api/1/*"
host_names: #The hostnames to match on
- api.domain.com
strip_headers: #remove these headers before replaying the request (list of strings). You can use wildcards such as
- "X-*" #strip away all X-type headers
- "User-Agent" #Strip away this and add a new one down below
- "Content-Length"
disable_replay_for_user_agent: TraefikReplayR/1.0.0 #You shouldn't normally change this, as it's being use to avoid sending looped messages (which will eventually kill your service)
add_headers: #add these headers (list of kv pairs)
- name: X-RiksTV-Synthetic
value: "true"
- name: User-Agent #We stripped away the original above (in strip_headers), add a custom one
value: TraefikReplayR/1.0.0 #should match disable_replay_for_user_agent. Used to avoid resending requests, which will DDOS your service
replay_factor: 0.01 #1 means one replay-request per original request. 0.1 means 10% of traffic etc. 2 means two replays per incoming request etc.
replace_hostname: #urls are always lower-cased before the matcher/replacer thing executes use fully qualified things (no wildcards)
match: api.domain.com
replace: api-staging.domain.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment