working node server
This commit is contained in:
1047
UI/_/code/quill.js
1047
UI/_/code/quill.js
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 8.3 KiB |
@@ -1,13 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<title>Admin</title>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<link rel="icon" href="/_/icons/shield.png">
|
|
||||||
<link rel="stylesheet" href="/_/code/shared.css">
|
|
||||||
<script src="/_/code/quill.js"></script>
|
|
||||||
<script type="module" src="75820185/index.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
12
http.js
Normal file
12
http.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
const http = require("http");
|
||||||
|
|
||||||
|
http.createServer((req, res) => {
|
||||||
|
const host = req.headers.host || "";
|
||||||
|
console.log("working")
|
||||||
|
res.writeHead(301, {
|
||||||
|
"Location": `https://${host}${req.url}`
|
||||||
|
});
|
||||||
|
res.end();
|
||||||
|
}).listen(2000, () => {
|
||||||
|
console.log("🔁 Redirect server running on port 2000");
|
||||||
|
});
|
||||||
12
index.js
12
index.js
@@ -4,6 +4,7 @@ const http = require("http");
|
|||||||
const https = require("https");
|
const https = require("https");
|
||||||
const tls = require("tls");
|
const tls = require("tls");
|
||||||
const httpProxy = require("http-proxy");
|
const httpProxy = require("http-proxy");
|
||||||
|
const { WebSocketServer } = require('ws')
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
// ---------------------------
|
// ---------------------------
|
||||||
@@ -80,13 +81,10 @@ function serveProxy(req, res, port) {
|
|||||||
proxy.on("error", (err, req, res) => {
|
proxy.on("error", (err, req, res) => {
|
||||||
console.error("Proxy error:", err.message);
|
console.error("Proxy error:", err.message);
|
||||||
|
|
||||||
if (res.headersSent) {
|
try {
|
||||||
res.end();
|
res.statusCode = 502;
|
||||||
return;
|
res.end("Bad Gateway");
|
||||||
}
|
} catch {}
|
||||||
|
|
||||||
res.writeHead(502, { "Content-Type": "text/plain" });
|
|
||||||
res.end("⚠️ target is unavailable. Please try again later.");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
proxy.on("proxyReq", (proxyReq, req, res) => {
|
proxy.on("proxyReq", (proxyReq, req, res) => {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
"start": "node index.js"
|
"start": "node index.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"http-proxy": "^1.18.1"
|
"http-proxy": "^1.18.1",
|
||||||
|
"ws": "^8.18.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user