add proxy to pandorabox tileserver
parent
54fed1c9a6
commit
24ccd3cb40
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"name": "minetest-tile-server",
|
||||
"version": "1.0.0",
|
||||
"description": "Minetest tileserver =======",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/thomasrudin-mt/minetest-tile-server.git"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/thomasrudin-mt/minetest-tile-server/issues"
|
||||
},
|
||||
"homepage": "https://github.com/thomasrudin-mt/minetest-tile-server#readme",
|
||||
"dependencies": {
|
||||
"connect": "^3.6.6",
|
||||
"http-proxy": "^1.17.0",
|
||||
"serve-static": "^1.13.2"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
var httpProxy = require('http-proxy'),
|
||||
http = require("http"),
|
||||
serveStatic = require('serve-static'),
|
||||
connect = require('connect');
|
||||
|
||||
|
||||
var proxy = httpProxy.createProxy({
|
||||
target: "https://pandorabox.io/map",
|
||||
secure: false
|
||||
});
|
||||
|
||||
var app = connect()
|
||||
.use("/", function(req, res, next){
|
||||
if (req.url.substring(0,3) == "/js"){
|
||||
console.log("Local: " + req.url);
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("Remote: " + req.url);
|
||||
proxy.web(req, res);
|
||||
})
|
||||
.use(serveStatic("src/main/resources/public"));
|
||||
|
||||
var server = http.createServer(app);
|
||||
|
||||
server.listen(8080);
|
||||
|
||||
console.log("Listening on http://127.0.0.1:8080");
|
Loading…
Reference in New Issue