Created
May 23, 2020 20:34
-
-
Save scorredoira/da7b43091f88aa8371b0b03b9bc4b3cc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "stdlib/native" | |
export function main() { | |
let url = http.parseURL("http://example.com/") | |
let proxy = httputil.newSingleHostReverseProxy(url) | |
let server = http.newServer() | |
server.address = ":9999" | |
server.handler = (w, r) => { | |
r.url.host = url.host | |
r.url.scheme = url.scheme | |
r.host = url.host | |
proxy.serveHTTP(w, r) | |
} | |
server.start() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment