prismarine-web-client
prismarine-web-client copied to clipboard
Guide on how to create a proxy that can be used with the github instance
proxy code:
#!/usr/bin/env node
const express = require('express')
const netApi = require('net-browserify')
const app = express()
app.use(netApi({ allowOrigin: '*' }))
// Start the server
const server = app.listen(process.argv[2] === undefined ? 8080 : process.argv[2], function () {
console.log('Server listening on port ' + server.address().port)
})
example of apache2 config (http):
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName pproxy.rom1504.fr
ProxyPass / http://localhost:8080/ retry=0
ProxyPassReverse / http://localhost:8080/
RewriteEngine on
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
https:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ProxyPreserveHost On
ProxyRequests Off
ServerName pproxy.rom1504.fr
ProxyPass / http://localhost:8080/ retry=0
ProxyPassReverse / http://localhost:8080/
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/rom1504.fr-0001/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/rom1504.fr-0001/privkey.pem
RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://localhost:8080/$1" [P,L]
</VirtualHost>
</IfModule>
would be useful to have:
- nginx example
- google cloud example (kubernetes ?)
should this go in it's own repo? , that way we can have one click solutions in gcp/aws
I think it's fine in a folder of this repo
would be good to add a check in that proxy so it can only connect to mc server (by using mc.ping before opening the connection)
Nginx:
upstream mineproxy {
server localhost:8080;
}
server {
# listen 80; # uncomment for http
listen 443 ssl; # comment for http
server_name pproxy.rom1504.fr;
ssl_certificate /etc/letsencrypt/live/rom1504.fr-0001/fullchain.pem; # comment for http
ssl_certificate_key /etc/letsencrypt/live/rom1504.fr-0001/privkey.pem; # comment for http
location / {
proxy_pass http://mineproxy;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Host $host;
}
}