Giter Club home page Giter Club logo

chaos-http-proxy's Introduction

Chaos HTTP Proxy

Introduce failures into HTTP requests via a proxy server. This can uncover error handling bugs in HTTP clients. Andrew Gaul at Bounce Storage [email protected] originally wrote Chaos HTTP Proxy.

Features

Chaos HTTP Proxy can trigger many different failures:

  • change case of HTTP header name
  • Content-MD5 request corruption
  • Content-MD5 response corruption
  • client timeout, HTTP 408
  • redirects (temporary and permanent)
  • reorder response headers
  • server connection break, i.e., short read and write
  • server errors: HTTP 500, 503, and 504
  • server timeout

Installation

Users can download releases from GitHub. One can also build the project by running mvn package which produces a binary at target/chaos-http-proxy. Chaos HTTP Proxy requires Java 8 to run.

Examples

Linux and Mac OS X users can run Chaos HTTP Proxy via the executable jar:

chmod +x chaos-http-proxy
chaos-http-proxy --properties chaos-http-proxy.conf

Windows users must explicitly invoke java:

java -jar chaos-http-proxy --properties chaos-http-proxy.conf

An example using curl:

curl --fail --proxy http://localhost:1080/ http://google.com/
curl: (22) The requested URL returned error: 500 Server Error

Configuring Failure Rates

The configuration file determines all possible results for an HTTP request. Entries take the form [response_type]=[n], where [n] is an integral value that determines the relative occurrence likelihood of each response type. For example, the following configuration gives a 1% chance of responses failing with a 500 Internal Error response:

com.bouncestorage.chaoshttpproxy.http_500=1
com.bouncestorage.chaoshttpproxy.success=99

Sample configuration

Chaos HTTP Proxy accepts configuration at invocation time via the --properties flag and at run-time via the /chaos/api endpoint:

curl --request POST --upload-file chaos-http-proxy.conf http://localhost:1080/chaos/api
curl http://localhost:1080/chaos/api
com.bouncestorage.chaoshttpproxy.success=100

Limitations

  • lacks HTTP authentication
  • lacks HTTPS support

References

  • Charles Web Debugging Proxy - allows interactive modification of HTTP requests and responses
  • Chaos Monkey - inspiration for Chaos HTTP Proxy
  • Hamms - designed to elicit failures in your HTTP Client, similar to httpbin
  • httpbin - HTTP Request & Response Service which can deterministically exercise HTTP functionality
  • pathod - programmable HTTP server
  • toxiproxy - A proxy to simulate network and system conditions
  • toxy - Hackable HTTP proxy to simulate server failure scenarios and unexpected network conditions
  • Vaurien - Chaos TCP Proxy

License

Copyright (C) 2015-2016 Bounce Storage

Licensed under the Apache License, Version 2.0

chaos-http-proxy's People

Contributors

dependabot[bot] avatar flandr avatar gaul avatar sullis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chaos-http-proxy's Issues

HTTPS support

it'd be good to have https support and induce chaos at the HTTPS layer

Read partial data

Chaos HTTP Proxy supports writing partial data to the client then closing the socket. It should also support reading partial data from the client then closing the socket. Suggested by @zack-shoylev.

Randomize XML elements

Some XML documents have a flexible ordering that streaming XML parsers do not understand. This was recently seen when parsing S3 ListBuckets responses in apache/jclouds#103. Note that other documents, for example XHTML, have a meaningful order so this should not be a default option. @timuralp

Simulate short reads

@timuralp suggests:

found an annoying bit about Swift's EC policy implementation: the object is reconstructed as part of streaming the response to client, so the client can get a 200 OK response and subsequently end up with a short read, because there is now way to indicate that a segment failed to be reconstructed

Docker image

Provide a docker image to allow easy proxying.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.