In that case, frameworks like Amber or Lucky are probably overkill. I would probably stick with using HTTP::Server directly:
require"http"classProxyincludeHTTP::Handlerdefcall(context:HTTP::Server::Context)# Do proxy things hereendendhttp=HTTP::Server.new([HTTP::LogHandler.new,# Log requestsHTTP::CompressHandler.new,# Gzip/Deflate response bodiesProxy.new,])http.listen"0.0.0.0",8080
All of your PROXY protocol things would happen inside of (or downstream from) the Proxy#call method. The context passed to that method contains references to the request and response objects. You'd be able to stream things from the destination back to the requestor to keep your TTFB and memory footprint low, whereas I believe Amber builds the entire response in memory before sending it over the network.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
In that case, frameworks like Amber or Lucky are probably overkill. I would probably stick with using
HTTP::Server
directly:All of your
PROXY
protocol things would happen inside of (or downstream from) theProxy#call
method. Thecontext
passed to that method contains references to the request and response objects. You'd be able to stream things from the destination back to the requestor to keep your TTFB and memory footprint low, whereas I believe Amber builds the entire response in memory before sending it over the network.