Git Product home page Git Product logo

nginx-echo-server's Introduction

nginx-echo-server

A simple openresty based image which acts as a catch-all server and echos back the request. A very poor man's version of httpbin.

Features

  • HTTP and HTTPS using self signed certificates
  • Echoes both request headers and body
  • Accepts any URL and HTTP method

API

  • /status/{httpStatus} - Responds with the given HTTP status
  • /jwt - Expects a JWT token as the body and returns the decoded token (Requires the JWT_SECRET environment variable to be set)
  • /websocket - WebSocket which echos the received payload. Responds to ping with pong.
  • /any/path/here - Matches any other path and simply echoes back the request headers and body

Usage

Start server
docker run -p 8080:80 -p 8443:443 checksum/nginx-echo-server
HTTPie
http --verify=no https://localhost:8443/api foo=bar "X-Custom-Header: nginx-is-awesome"
Curl
curl -X POST --insecure -i https://localhost:8443/api -H "Content-Type: application/json" -d '{"foo": "bar"}'
Response
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json
Date: Mon, 13 May 2019 00:49:45 GMT
Transfer-Encoding: chunked
accept: application/json, */*
accept-encoding: gzip, deflate
host: localhost:8443
user-agent: HTTPie/0.9.9
x-custom-header: nginx-is-awesome

{
    "foo": "bar"
}

nginx-echo-server's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.