Skip to content

Proxy config secure flag #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ angular-http-server --config configs/angular-http-server.config.js --useProxy tr

To configure the proxy add a proxy object to your config file.
The proxy should be an array of configs with two required properties: a forward property which must be a string array listing url parts which should trigger the proxy, and a target property which should define the target to proxy to.
The config can also contain an optional protocol option, when this is absent the server will default to https
The config can also contain an optional protocol option, when this is absent the server will default to https. With the optional secure option you can define if the proxy should verify SSL certificates. When no secure option is specified, it will use true as default.

simple example:

Expand All @@ -142,6 +142,7 @@ module.exports = {
{
forward: ["api/example-api-2", "api-proxy-2/example"],
target: "localhost:6000",
secure: false
},
],
};
Expand Down
2 changes: 1 addition & 1 deletion lib/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function proxyHandler(req, res, configs) {
);

if (proxyServer === null) {
proxyServer = httpProxy.createProxyServer({});
proxyServer = httpProxy.createProxyServer({secure: config.secure === undefined ? true : config.secure});
}

proxyServer.web(req, res, {
Expand Down
2 changes: 1 addition & 1 deletion lib/proxy.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe("proxyHandler", () => {
});

expect(() => proxyHandler(req, {}, null, false)).to.throw(
"no proxyConfig present, please configure in your config file"
"no proxy configs present, please configure in your config file"
);
});

Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
},
{
"name": "AVierwind"
},
{
"name": "tomtucker18"
}
],
"engines": {
Expand Down