jmalloc/echo-server
소개
An HTTP and WebSocket "echo" server for testing proxies and HTTP clients.
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- +1
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalEcho Server
A very simple HTTP echo server with support for websockets and server-sent events (SSE).
The server is designed for testing HTTP proxies and clients. It echoes information about HTTP request headers and bodies back to the client.
Behavior
- Any messages sent from a websocket client are echoed as a websocket message.
- Requests to a file named
.wsunder any path serve a basic UI to connect and send websocket messages. - Requests to a file named
.sseunder any path streams server-sent events. - Request any other URL to receive the echo response in plain text.
Configuration
Port
The PORT environment variable sets the server port, which defaults to 8080.
Logging
Set the LOG_HTTP_HEADERS environment variable to print request headers to
STDOUT. Additionally, set the LOG_HTTP_BODY environment variable to print
entire request bodies.
Server Hostname
Set the SEND_SERVER_HOSTNAME environment variable to false to prevent the
server from responding with its hostname before echoing the request. The client
may send the X-Send-Server-Hostname request header to true or false to
override this server-wide setting on a per-request basis.
Arbitrary Headers
Set the SEND_HEADER_<header-name> variable to send arbitrary additional
headers in the response. Underscores in the variable name are converted to
hyphens in the header. For example, the following environment variables can be
used to disable CORS:
SEND_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN="*"
SEND_HEADER_ACCESS_CONTROL_ALLOW_METHODS="*"
SEND_HEADER_ACCESS_CONTROL_ALLOW_HEADERS="*"
WebSocket URL
Set the WEBSOCKET_ROOT environment variable to prefix all websocket
requests made by the .ws user interface with a specific path.
Running the server
The examples below show a few different ways of running the server with the HTTP
server bound to a custom TCP port of 10000.
Running locally
go get -u github.com/jmalloc/echo-server/...
PORT=10000 echo-server
Running under Docker
To run the latest version as a container:
docker run --detach -p 10000:8080 jmalloc/echo-server
Or, as a swarm service:
docker service create --publish 10000:8080 jmalloc/echo-server
The docker container can be built locally with:
make docker
관련 프로젝트 살펴보기
불러오는 중…