Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simonkowallik/httpbin
:twisted_rightwards_arrows: HTTP Request & Response Service, written in Python + Flask.
https://github.com/simonkowallik/httpbin
container httpbin request-response
Last synced: 3 months ago
JSON representation
:twisted_rightwards_arrows: HTTP Request & Response Service, written in Python + Flask.
- Host: GitHub
- URL: https://github.com/simonkowallik/httpbin
- Owner: simonkowallik
- License: isc
- Created: 2019-03-09T07:28:37.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2023-01-07T12:19:45.000Z (about 2 years ago)
- Last Synced: 2024-10-03T08:15:24.562Z (4 months ago)
- Topics: container, httpbin, request-response
- Language: Python
- Homepage:
- Size: 838 KB
- Stars: 6
- Watchers: 2
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-f5 - httpbin - Ever heard of httpbin.org? This is a containerized and improved version of httpbin with added features running on nginx, unit, httpd or gunicorn! (Ops tools)
README
# httpbin(1): HTTP Request & Response Service
[![httpbin Tests](https://github.com/simonkowallik/httpbin/actions/workflows/httpbin-ci.yaml/badge.svg)](https://github.com/simonkowallik/httpbin/actions/workflows/httpbin-ci.yaml)
[![Container Build](https://github.com/simonkowallik/httpbin/actions/workflows/container-build.yaml/badge.svg)](https://github.com/simonkowallik/httpbin/actions/workflows/container-build.yaml)This httpbin fork is updated and tailored to my personal needs.
As [postmanlabs / httpbin](https://github.com/postmanlabs/httpbin) is stale and did not see an update in several years I felt the need to maintain my own version.## Supported docker tags
![Docker Image Size (tag)](https://img.shields.io/docker/image-size/simonkowallik/httpbin/latest?label=latest)
![Docker Image Size (tag)](https://img.shields.io/docker/image-size/simonkowallik/httpbin/alpine?label=alpine)
![Docker Image Size (tag)](https://img.shields.io/docker/image-size/simonkowallik/httpbin/nginx?label=nginx)
![Docker Image Size (tag)](https://img.shields.io/docker/image-size/simonkowallik/httpbin/httpd?label=httpd)
![Docker Image Size (tag)](https://img.shields.io/docker/image-size/simonkowallik/httpbin/httpd-alpine?label=httpd-alpine)
![Docker Image Size (tag)](https://img.shields.io/docker/image-size/simonkowallik/httpbin/unit?label=unit)- **`:latest`** / **`:alpine`** : Plain httpbin with gunicorn on Debian / Alpine Linux.
- **`:nginx`** : Uses [nginx](https://github.com/nginx/nginx) and [uwsgi](https://github.com/unbit/uwsgi) with `nginx:alpine` as the base image.
> Supports HTTPS and HTTP2. TLS Certificates & keys are automatically generated but can be overwritten / mapped using docker:
>
> - `/etc/nginx/ssl/dhparam.pem`
> - `/etc/nginx/ssl/eccert.pem` (ecdsa)
> - `/etc/nginx/ssl/eckey.pem` (ecdsa)
> - `/etc/nginx/ssl/cert.pem` (rsa)
> - `/etc/nginx/ssl/key.pem` (rsa)
> - `/etc/nginx/ssl/chain.pem`
> - `/etc/nginx/nginx.conf`
> - `/etc/uwsgi/uwsgi.ini`- **`:unit`** : Uses [nginx unit](https://github.com/nginx/unit) with base image `alpine`.
> Supports HTTPS and HTTP2. TLS Certificates & keys are automatically generated but can be overwritten / mapped using docker:
>
> - `/var/lib/unit/certs/bundle` (bundle content created by: `cat cert.pem cachain.pem key.pem > bundle`)
> - `/var/lib/unit/conf.json`- **`:httpd`** : Uses [httpd](https://github.com/docker-library/httpd) and [uwsgi](https://github.com/unbit/uwsgi) with `httpd:latest` as the base image.
> Supports HTTPS. TLS Certificates & keys are automatically generated but can be overwritten / mapped using docker:
>
> - `/usr/local/apache2/conf/ssl/dhparam.pem`
> - `/usr/local/apache2/conf/ssl/eccert.pem` (ecdsa)
> - `/usr/local/apache2/conf/ssl/eckey.pem` (ecdsa)
> - `/usr/local/apache2/conf/ssl/cert.pem` (rsa)
> - `/usr/local/apache2/conf/ssl/key.pem` (rsa)
> - `/usr/local/apache2/conf/ssl/chain.pem`
> - `/usr/local/apache2/conf/httpd.conf`
> - `/usr/local/apache2/conf/extra/vhosts/*.conf`
> - `/etc/uwsgi/uwsgi.ini`- **`:httpd-alpine`** : Uses [httpd](https://github.com/docker-library/httpd) and [uwsgi](https://github.com/unbit/uwsgi) with `httpd:alpine` as the base image.
> Supports HTTPS. TLS Certificates & keys are automatically generated but can be overwritten / mapped using docker:
>
> - `/usr/local/apache2/conf/ssl/dhparam.pem`
> - `/usr/local/apache2/conf/ssl/eccert.pem` (ecdsa)
> - `/usr/local/apache2/conf/ssl/eckey.pem` (ecdsa)
> - `/usr/local/apache2/conf/ssl/cert.pem` (rsa)
> - `/usr/local/apache2/conf/ssl/key.pem` (rsa)
> - `/usr/local/apache2/conf/ssl/chain.pem`
> - `/usr/local/apache2/conf/httpd.conf`
> - `/usr/local/apache2/conf/extra/vhosts/*.conf`
> - `/etc/uwsgi/uwsgi.ini`## Usage
Simple example:
```sh
docker run -p 80:80 -p 443:443 simonkowallik/httpbin:nginxdocker run -p 80:80 -p 443:443 simonkowallik/httpbin:httpd
docker run -p 80:80 -p 443:443 simonkowallik/httpbin:httpd-alpine
docker run -p 80:80 -p 443:443 simonkowallik/httpbin:unit
docker run -p 80:80 simonkowallik/httpbin
```## Advanced features
### Return custom HTTP header and value on every response
```shell
$ docker run -it --rm -p 80:80 -p 443:443 \
-e XHTTPBIN_X_instance_id="instance-id-1" \
ghcr.io/simonkowallik/httpbin:unit```
```sheel
$ curl -vsk http://localhost/get
..
> GET /get HTTP/1.1
..
< HTTP/1.1 200 OK
..
< X-Powered-By: httpbin/0.9.2
< X-instance-id: instance-id-1
< Server: Unit/1.28.0
..
```### Set custom tags on `/tags` endpoint
```shell
$ docker run -it --rm -p 80:80 -p 443:443 \
-e HTTPBIN_Instance=1 \
-e HTTPBIN_2ndTag="Some Value" \
ghcr.io/simonkowallik/httpbin:nginx```
```shell
$ curl -vsk http://localhost/tags> GET /tags HTTP/1.1
> Host: localhost:11080
> User-Agent: curl/7.74.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx/1.23.3
< Date: Sat, 17 Dec 2022 14:45:48 GMT
< Content-Type: application/json
< Content-Length: 48
< Connection: keep-alive
< X-Powered-By: httpbin/0.9.2
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Credentials: true
<
{
"2ndTag": "Some Value",
"Instance": "1"
}
```## Contributors
Thanks to:
- [@v-slenter](https://github.com/v-slenter) for [#9](https://github.com/simonkowallik/httpbin/pull/9)