v3.0.8: update deps, add example
This commit is contained in:
		
							parent
							
								
									d324179cb1
								
							
						
					
					
						commit
						a7526ffad8
					
				
							
								
								
									
										37
									
								
								examples/http-proxy.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								examples/http-proxy.js
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require("@root/greenlock-express")
 | 
				
			||||||
 | 
						.init(function getConfig() {
 | 
				
			||||||
 | 
							return { package: require("../package.json") };
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
						.serve(httpsWorker);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function httpsWorker(glx) {
 | 
				
			||||||
 | 
						var proxy = require("http-proxy").createProxyServer({ xfwd: true });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// we need the raw https server
 | 
				
			||||||
 | 
						var server = glx.httpsServer();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// catches error events during proxying
 | 
				
			||||||
 | 
						proxy.on("error", function(err, req, res) {
 | 
				
			||||||
 | 
							console.error(err);
 | 
				
			||||||
 | 
							res.statusCode = 500;
 | 
				
			||||||
 | 
							res.end();
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// We'll proxy websocketts too
 | 
				
			||||||
 | 
						server.on("upgrade", function(req, socket, head) {
 | 
				
			||||||
 | 
							proxy.ws(req, socket, head, {
 | 
				
			||||||
 | 
								ws: true,
 | 
				
			||||||
 | 
								target: "ws://localhost:1443"
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// servers a node app that proxies requests to a localhost
 | 
				
			||||||
 | 
						glx.serveApp(function(req, res) {
 | 
				
			||||||
 | 
							proxy.web(req, res, {
 | 
				
			||||||
 | 
								target: "http://localhost:3000"
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										14
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										14
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -40,9 +40,9 @@
 | 
				
			|||||||
			"integrity": "sha512-OaEub02ufoU038gy6bsNHQOjIn8nUjGiLcaRmJ40IUykneJkIW5fxDqKxQx48cszuNflYldsJLPPXCrGfHs8yQ=="
 | 
								"integrity": "sha512-OaEub02ufoU038gy6bsNHQOjIn8nUjGiLcaRmJ40IUykneJkIW5fxDqKxQx48cszuNflYldsJLPPXCrGfHs8yQ=="
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		"@root/greenlock": {
 | 
							"@root/greenlock": {
 | 
				
			||||||
			"version": "3.0.12",
 | 
								"version": "3.0.17",
 | 
				
			||||||
			"resolved": "https://registry.npmjs.org/@root/greenlock/-/greenlock-3.0.12.tgz",
 | 
								"resolved": "https://registry.npmjs.org/@root/greenlock/-/greenlock-3.0.17.tgz",
 | 
				
			||||||
			"integrity": "sha512-jizQNf4OZcEugm875IBnd8GR78fkU6leLbq44ARJYX8ot/VKShEZpus5n/mTzrJHMgrQvFJU2mkPGJmG0+yvzg==",
 | 
								"integrity": "sha512-1XKhcLFEx1WFdn1Bc2rkAE/SL1ZUJYYMZdbnehTrfhCr5Y+9U1gdkNZnR/jInhoUvcicF/PXuZkGVucU50RNUg==",
 | 
				
			||||||
			"requires": {
 | 
								"requires": {
 | 
				
			||||||
				"@root/acme": "^3.0.8",
 | 
									"@root/acme": "^3.0.8",
 | 
				
			||||||
				"@root/csr": "^0.8.1",
 | 
									"@root/csr": "^0.8.1",
 | 
				
			||||||
@ -51,7 +51,7 @@
 | 
				
			|||||||
				"@root/request": "^1.3.10",
 | 
									"@root/request": "^1.3.10",
 | 
				
			||||||
				"acme-http-01-standalone": "^3.0.5",
 | 
									"acme-http-01-standalone": "^3.0.5",
 | 
				
			||||||
				"cert-info": "^1.5.1",
 | 
									"cert-info": "^1.5.1",
 | 
				
			||||||
				"greenlock-manager-fs": "^0.7.0",
 | 
									"greenlock-manager-fs": "^3.0.1",
 | 
				
			||||||
				"greenlock-store-fs": "^3.2.0",
 | 
									"greenlock-store-fs": "^3.2.0",
 | 
				
			||||||
				"safe-replace": "^1.1.0"
 | 
									"safe-replace": "^1.1.0"
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@ -106,9 +106,9 @@
 | 
				
			|||||||
			"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
 | 
								"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		"greenlock-manager-fs": {
 | 
							"greenlock-manager-fs": {
 | 
				
			||||||
			"version": "0.7.0",
 | 
								"version": "3.0.1",
 | 
				
			||||||
			"resolved": "https://registry.npmjs.org/greenlock-manager-fs/-/greenlock-manager-fs-0.7.0.tgz",
 | 
								"resolved": "https://registry.npmjs.org/greenlock-manager-fs/-/greenlock-manager-fs-3.0.1.tgz",
 | 
				
			||||||
			"integrity": "sha512-cWmrfdSbT0ettDZzl6SXhZ47gVLj7saM/tdEP6sEfnsocJ3mRFRP3QUrJYyLVdCOCuVH6cclOKLembIrZjwDrQ==",
 | 
								"integrity": "sha512-vZfGFq1TTKxaAqdGDUwNservrNzXx0xCwT/ovG/N378GrhS+U5S8B8LUlNtQU7Fdw6RToMiBcm22OOxSrvZ2zw==",
 | 
				
			||||||
			"requires": {
 | 
								"requires": {
 | 
				
			||||||
				"@root/mkdirp": "^1.0.0",
 | 
									"@root/mkdirp": "^1.0.0",
 | 
				
			||||||
				"safe-replace": "^1.1.0"
 | 
									"safe-replace": "^1.1.0"
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	"name": "@root/greenlock-express",
 | 
						"name": "@root/greenlock-express",
 | 
				
			||||||
	"version": "3.0.7",
 | 
						"version": "3.0.8",
 | 
				
			||||||
	"description": "Free SSL and managed or automatic HTTPS for node.js with Express, Koa, Connect, Hapi, and all other middleware systems.",
 | 
						"description": "Free SSL and managed or automatic HTTPS for node.js with Express, Koa, Connect, Hapi, and all other middleware systems.",
 | 
				
			||||||
	"main": "greenlock-express.js",
 | 
						"main": "greenlock-express.js",
 | 
				
			||||||
	"homepage": "https://greenlock.domains",
 | 
						"homepage": "https://greenlock.domains",
 | 
				
			||||||
@ -17,7 +17,7 @@
 | 
				
			|||||||
		"example": "examples"
 | 
							"example": "examples"
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	"dependencies": {
 | 
						"dependencies": {
 | 
				
			||||||
		"@root/greenlock": "^3.0.12",
 | 
							"@root/greenlock": "^3.0.17",
 | 
				
			||||||
		"redirect-https": "^1.1.5"
 | 
							"redirect-https": "^1.1.5"
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	"trulyOptionalDependencies": {
 | 
						"trulyOptionalDependencies": {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user