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

bfn-proxy

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bfn-proxy - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

22

lib/bfn-proxy.js

@@ -52,13 +52,19 @@ 'use strict'

if (res.statusCode && res.headers) {
if (res.statusCode >= 200 && res.statusCode <= 299) {
if (opts.enableCORS && request.headers.origin) res.headers['access-control-allow-origin'] = '*'
if (opts.enableCORS && request.headers.origin) res.headers['access-control-allow-origin'] = '*'
if ((res.statusCode >= 200 && res.statusCode <= 299) || res.statusCode === 304) {
response.writeHead(res.statusCode, res.headers)
res.pipe(response, {end: true})
} else {
if (~[301, 302].indexOf(res.statusCode) && res.headers.location) {
var statusMsg = '<!DOCTYPE html><html><head><title>' + res.statusCode + '</title></head><body><pre>' + JSON.stringify(res.headers, null, 4) + '</pre></body></html>'
res.headers['content-length'] = statusMsg.length
res.headers['content-type'] = 'text/html'
response.writeHead(404, res.headers)
response.end(statusMsg)
if (~[301, 302, 303, 307, 308].indexOf(res.statusCode) && res.headers.location) {
if (request.headers.host) {
res.headers.location = (request.headers['x-forwarded-proto'] || 'http') + '://' + request.headers.host + '//' + res.headers.location
response.writeHead(res.statusCode, res.headers)
res.pipe(response, {end: true})
} else {
var statusMsg = '<!DOCTYPE html><html><head><title>' + res.statusCode + '</title></head><body><pre>' + JSON.stringify(res.headers, null, 4) + '</pre></body></html>'
res.headers['content-length'] = statusMsg.length
res.headers['content-type'] = 'text/html'
response.writeHead(404, res.headers)
response.end(statusMsg)
}
} else {

@@ -65,0 +71,0 @@ response.writeHead(res.statusCode, res.headers)

{
"name": "bfn-proxy",
"version": "1.3.1",
"version": "1.3.2",
"description": "HTTP request proxy middleware for node.js",

@@ -5,0 +5,0 @@ "author": "Blue Fidelity Inc. (https://www.bluefidelity.com/)",

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