How would I make a Proxy that I can host with DigitalOcean?

I tried looking at various tutorials like this one,

but it just didn’t work so, how would I do it?

1 Like

main question is what r u using a proxy for? discord? that would be easier but anyway here’s how to create a proxy using whatever vps u want

  1. somehow find your digitalocean ip, ssh port (probably 22) and password (i dont use digitalocean)
  2. download vs code, i think you have to install a specific extension for it, just search “ssh” in extensions
  3. on the left bottom corner there should be a cmd looking icon, press and find anything related to “connect to ssh”
  4. put your ip and port in this format: ip:port, ex. 123.69.4.20:22
  5. if they ask for the password just give it
  6. wait until ur connected
  7. if ur asked to open a folder, skip first (idk how to create a folder in the vscode ui)
  8. on the upper bar there’s “View”, hover it and press “New Terminal”
  9. idk what operating system ur vps uses, but if it’s any linux dist then use nodesource’s. find it here: GitHub - nodesource/distributions: NodeSource Node.js Binary Distributions (please fully read and understand it, u could somehow install nodejs v12 if ur wrong (doesnt really matter))
  10. in the terminal just write mkdir /home/name, change name to anything u want to call the folder. this creates a folder in /home, years of using vps’ and i cant figure out where to create folders
  11. in the “file” on the topbar of ur vscode hover it and press “open folder”. put the folder path earlier (/home/name) (once again reminding to change name to your folder name earlier)
  12. once u opened the folder create a file called index.js or whatever u want, just remember it
  13. IMPORTANT: install express and node-fetch by typing npm i express node-fetch@2.0.0 in ur terminal (i forgot how to use the http builtin module lol)
  14. when u succesfully created the file i suppose vscode automatically opens the file, so just write this code in it
const express = require("express")
const fetch = require("node-fetch")
const proxy = express()

proxy.get("/", (req, res) => {
  const url = req.query.url
  fetch(url).then(result => result.text()).then(response => { // requests to the url given
    res.send(response)
  }).catch(() => res.send("failed lmao"))
})

proxy.listen(8080, () => { console.log("proxy is on") }) // indicates if the port is open (127.0.0.1:8080)

so this would open a port on your vps ip, and the url would be ip:8080 (im pretty sure 8080 is widely used)
15. in the terminal write node index.js (reminder to change index.js to your file name)
16. wait until it says “proxy is on”, since that is what i wrote in the code to indicate if the port is open.
17. if you want to use it on roblox (reminder to enable http reqs in game settings), use

local HttpService = game:GetService("HttpService")
local response = HttpService:GetAsync("http://yourVPSip:8080/?url=https://gyatrizz.org")
print("HTTP RESPONSE", response)

change https://gyatrizz.org to whatever url u want to fetch

keep in mind i didnt test any of these, but it should work :grin:

So lets say my computer is off will is still run?

What extension are you talking about?

1 Like

and what password are you talking about

yes, since you bought a vps, which is like a computer that u rent that should run 24/7 to run your programs.

vscode extension
image

i dont use digitalocean, so please figure it out.