Skip to content
This repository has been archived by the owner on Nov 19, 2023. It is now read-only.

Nothing works on Node 16 #68

Open
mifi opened this issue Feb 17, 2022 · 4 comments
Open

Nothing works on Node 16 #68

mifi opened this issue Feb 17, 2022 · 4 comments
Labels

Comments

@mifi
Copy link

mifi commented Feb 17, 2022

This example https://github.com/h2non/toxy/blob/master/examples/bandwidth-limit.js or even this simple code:

const toxy = require('toxy')
const http = require('http');

const proxy = toxy()

const rules = proxy.rules
const poisons = proxy.poisons

proxy
  .forward('http://httpbin.org')

proxy.all('/*')

proxy.listen(3000)
console.log('Server listening on port:', 3000)

...doesn't work.

When connecting with curl:

curl -vvv http://localhost:3000/ 
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 3000 (#0)
> GET / HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.64.1
> Accept: */*
> 
* Empty reply from server
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server
* Closing connection 0

Works fine with node v10.

@h2non
Copy link
Owner

h2non commented Feb 17, 2022

toxy is no longer actively maintained, I'm sorry. Although, it can be easily adapted to work with node v14+, but it would be quicker to use other maintained solutions out there, such as toxiproxy

@h2non h2non added the question label Feb 17, 2022
@mifi
Copy link
Author

mifi commented Feb 17, 2022

Thanks for your fast reply! I also went with toxiproxy. That's a pity, because toxy is a really cool tool, and even seems to support more features than toxyproxy. Maybe you could put a note on top of the readme warning people that it's no longer maintained and not working on latest Node.js, or looking for maintainer, if you are open for someone taking over:)

@h2non
Copy link
Owner

h2non commented Feb 17, 2022

Right, just done!

@stepankuzmin
Copy link

Also stumbled on this. For anyone who is interested, you'd need to add at least one poison for it to work, e.g.:

-proxy.all('/*')
+proxy
+  .all('/*')
+  .poison(poisons.latency(0))

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants