jmalloc / echo-server Goto Github PK
View Code? Open in Web Editor NEWAn HTTP and WebSocket "echo" server for testing proxies and HTTP clients.
License: MIT License
An HTTP and WebSocket "echo" server for testing proxies and HTTP clients.
License: MIT License
The server sends an unsolicited initial WebSocket message
echo-server/cmd/echo-server/main.go
Lines 106 to 113 in b9eb3f7
Would you be open to add an option to skip it?
Refs: markthethomas/ws-echo#1
I noticed that the latest tag has a different architecture then the previous. This change breaks thing in a project i am working on. Was this intentional?
eg:
# start
PORT=8080 APP_ROOT=/app echo-server
# access
curl localhost:8080/app/
Thx.
I don't see any headers get output
The server should support serving HTTPS/WSS using a configurable cert chain. If no such configuration is provided it should generate a self-signed certificate on-the-fly.
Hello! Thank you for this project.
I used it for comparing different requests I was making from vanilla fetch
API and through a proxy service I do not have direct control over.
The problem I faced with was a CORS, because I worked with Electron-based app (which is a browser under the hood):
Access to fetch at 'http://localhost:8080/' from origin 'app://obsidian.md' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
To fix the error I've added the following line to serveHTTP
:
wr.Header().Set("Access-Control-Allow-Origin", "*")
wr.Header().Set("Access-Control-Allow-Methods", "*")
wr.Header().Set("Access-Control-Allow-Headers", "*")
Consider adding those headers with an option you can configure on startup.
Hi ๐๐ผ In order to combat dockerhub's imposed rate limits it would be great to host these images on GHCR.
Push echo-server to an additional registry like GHCR
Thanks!
wss from generated self signed cert/key or from mount folder with cert/key
Would you feel comfortable having version tags on DockerHub, in addition to latest? I don't expect the behavior will change radically, but I'm a bit more comfortable if dependencies are pinned.
Hi.
I am using your echo server (wss://ws.ifelse.io/) as a test to check my library for web-socket connection. The language is C# and I use .Net Framework 4.5 platform (there is some requirement to use deprecated stack). Internally I use ClientWebSocket and all works fine from my local PC.
But, as I call the same (just establish websocket connection ) from the GitHub workflow (I have some simple CI test automation on GutHub) I got the following error:
System.Exception: At method OpenConnection was occured exeption:The server returned status code '403' when status code '101' was expected.
I can't have any idea of what causing this behaviour. I looked at the source code and didn't find any that could cause this. So maybe any suggestions or ideas I would give here. Thanks
Thanks for making this! This might be obvious, but I was confused at first when PORT
by itself didn't work for me, but adding --publish
fixed it. Maybe an example in the README of the correct usage?
$ docker run --detach -P -e PORT=80 --name echo1 jmalloc/echo-server
$ docker logs echo1
Echo server listening on port 80.
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
40d0d62870b4 jmalloc/echo-server "/bin/echo-server" 30 seconds ago Up 29 seconds 0.0.0.0:32995->8080/tcp echo1
$ curl http://localhost:32995
curl: (52) Empty reply from server
$ docker run --detach --publish 11111:80 -e PORT=80 --name echo2 jmalloc/echo-server
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
114811d87923 jmalloc/echo-server "/bin/echo-server" 7 seconds ago Up 7 seconds 8080/tcp, 0.0.0.0:11111->80/tcp echo2
40d0d62870b4 jmalloc/echo-server "/bin/echo-server" About a minute ago Up About a minute 0.0.0.0:32995->8080/tcp echo1
$ curl http://localhost:11111
Request served by 114811d87923
HTTP/1.1 GET /
Host: localhost:11111
User-Agent: curl/7.52.1
Accept: */*
This would be similar to the existing LOG_HTTP_BODY environment variable.
SOrry, I've not understood how to set environnmental variables to print out the body of my post requests
Blocked by #8
How do you open a shell?
kubectl exec -ti POD /bin/bash
does not work
In
echo-server/cmd/echo-server/main.go
Line 254 in 695e6e6
HTTP-Version Method Request-URI
, while the RFC https://www.rfc-editor.org/rfc/rfc2616#section-5.1 states it is Method Request-URI HTTP-Version
This confused me as I thought the reverse proxy I was trying to debug was mangling the request.
I realised when looking at the code that the line needs to be re-created from the request. I think it should be rebuilt in the expected order.
This is a change to the CI workflow to avoid the issue occurring in the build of #5.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.