Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

4game-server

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

4game-server - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

29

lib/proxy.js

@@ -7,4 +7,6 @@ /**

var https = require('https');
var parseUrl = require('url').parse;
var extend = require('xtend');
const rewriteFiles = [
var rewriteFiles = [
'/r/js/requirejs-lookup.js',

@@ -22,6 +24,4 @@ '/js/requirejs-external.js'

return function(req, res, next) {
var url = req.url.split('?')[0]
if (rewriteFiles.indexOf(url) !== -1 || /^\/(packages|launcher|c\/_favicons|c\/home)\//.test(url)) {
proxy(host + req.url, res, options);
if (shouldProxyUrl(req.url)) {
proxy(host + req.url, req.headers, res, options);
} else {

@@ -33,4 +33,9 @@ next();

function proxy(url, res, options) {
return https.get(url, function(pres) {
function proxy(url, headers, res, options) {
var reqOptions = parseUrl(url);
reqOptions.headers = extend(headers || {});
delete reqOptions.headers.host;
reqOptions.headers.connection = 'close';
return https.get(reqOptions, function(pres) {
res.writeHead(pres.statusCode, pres.headers);

@@ -44,2 +49,12 @@ pres.pipe(res);

});
}
function shouldProxyUrl(url) {
if (typeof url === 'string') {
url = parseUrl(url, true);
}
return rewriteFiles.indexOf(url.pathname) !== -1
|| /^\/(packages|launcher|c\/_favicons|c\/home)\//.test(url.pathname)
|| (url.query && 'popupWidget' in url.query);
}
{
"name": "4game-server",
"version": "1.0.0",
"version": "1.0.1",
"bin": {

@@ -5,0 +5,0 @@ "4game-server": "bin/4game-server"

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc