Installations
npm install nginx-upstream-http-fix
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
8.11.4
NPM Version
5.6.0
Score
49.8
Supply Chain
86.3
Quality
68.8
Maintenance
50
Vulnerability
96.5
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
Volem
Download Statistics
Total Downloads
9,225
Last Day
1
Last Week
3
Last Month
9
Last Year
7,454
GitHub Statistics
6 Stars
63 Commits
4 Forks
4 Watching
1 Branches
1 Contributors
Bundle Size
19.63 kB
Minified
6.17 kB
Minified + Gzipped
Package Meta Information
Latest Version
0.1.4
Package Id
nginx-upstream-http-fix@0.1.4
Unpacked Size
37.51 kB
Size
7.44 kB
File Count
12
NPM Version
5.6.0
Node Version
8.11.4
Total Downloads
Cumulative downloads
Total Downloads
9,225
Last day
0%
1
Compared to previous day
Last week
200%
3
Compared to previous week
Last month
80%
9
Compared to previous month
Last year
439%
7,454
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
nginx-upstream ![Build Status](https://travis-ci.org/Volem/nginx-upstream.svg?branch=master)
Currently it is on release v0.1.3 and maintains primary functionality over nginx config file. Usage is pretty simple, you can use it with require to get our main class and use its instance with below constructor parameters.
1npm install nginx-upstream --save
1var NginxManager = require('nginx-upstream'); 2var nginxManager = new NginxManager('<path>/nginx.conf', 50);
First of all, let's take a look at the type definition of the package starting from constructor.
1class NginxUpstream { 2 constructor(nginxConfigFilePath: string, fileSyncTime?: number);
As expected our class initializes with the nginx config file path as first parameter. Second parameter is the timeout for waiting changes on config file. Default is 50ms and it is generally ok for nowadays disks.
Nginx requires upstream block for load balancing operations. You can add new backend to your upstream block by addBackend method. Below is the definition of it;
1addBackend(host: string, callback: (err: any) => void);
addBackend method requires the host definition together with the port where the backend application server exits. This host definition can be either like ip:port or like fqdn:port. ie. 123.45.67.89:80 or www.example.com:81
Here port definition is always required even if your backend server is a web server and by default hosts over 80 port, you need to mention this to your Nginx server and our method also requires this port information to set nginx configuration file correctly.
Second parameter is callback, where you need to provide to understand if the configuration set successfully or not. Usage example;
1nginxManager.addBackend('mybackendserver.io:8081', function(err){ 2 if(err){ 3 console.log(err); 4 return; 5 } else { 6 // Do something after backend server added. 7 } 8});
Another method is of nginx-upstream is toggleBackend, which is for enabling or disabling your backend server. This is realy useful when you want to make maintenance on one of your backend server or something is wrong with it and you want it to be disabled temporarily. Even if you want to remove your backend server than it is wise to disable it first and than remove it.
Below is the definition and usage of toggleBackend;
1// Definition
2toggleBackend(host: string, callback: (err: any, status: boolean) => void);
3
4// Usage
5nginxManager.toggleBackend('localhost:81', function(err, status){
6 if(err){
7 console.log(err);
8 return;
9 } else if(status)
10 // Do something if status enabled.
11 } else {
12 // Do something else if status disabled.
13 }
14});
It is like add backend and it requires the host name together with its port. When you toggle your backend host "localhost:81" of this configuration.
1# Upstream Servers 2upstream nginxconf { 3 server localhost:81; 4 server localhost:82; 5}
the nginx configuration file would be like below;
1# Upstream Servers 2upstream nginxconf { 3 server localhost:81 down; # Disabled backend 4 server localhost:82; 5}
Ofcourse we have another method for removing the backend server from the nginx configuration file. It goes like below for the same upstream block;
1// Definition 2removeBackend(host: string, callback: (err: any) => void); 3// Usage 4nginxManager.removeBackend('localhost:81', function(err){ 5 if(err){ 6 console.log(err); 7 return; 8 } else 9 // Do something after backend server removed. 10});
After calling the removeBackend method, upstream block would be;
1# Upstream Servers 2upstream nginxconf { 3 server localhost:82; 4}
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
38 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9
- Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h
- Warn: Project is vulnerable to: GHSA-qh2h-chj9-jffq
- Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6
- Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9
- Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f
- Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p
- Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv
- Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8
- Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65
- Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh
- Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44
- Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988
- Warn: Project is vulnerable to: GHSA-4hpf-3wq7-5rpr
- Warn: Project is vulnerable to: GHSA-f522-ffg8-j8r6
- Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546
- Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx
- Warn: Project is vulnerable to: GHSA-282f-qqgm-c34q
- Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm
- Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574
- Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm
- Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-446m-mv8f-q348
- Warn: Project is vulnerable to: GHSA-8hfj-j24r-96c4
- Warn: Project is vulnerable to: GHSA-wc69-rhjr-hc9g
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6
- Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj
Score
1.3
/10
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More