Skip to content

Commit a555222

Browse files
authored
Merge branch 'master' into fix/fixRequestBody
2 parents e0f64c3 + 1ee26ed commit a555222

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+5640
-3165
lines changed

.editorconfig

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ trim_trailing_whitespace = true
1313
[*.md]
1414
trim_trailing_whitespace = false
1515

16-
# Matches the exact files either package.json or .travis.yml
17-
[{package.json,.travis.yml}]
16+
# Matches the exact files
17+
[{package.json}]
1818
indent_size = 2

.eslintignore

-1
This file was deleted.

.eslintrc.js

-30
This file was deleted.

.github/workflows/ci.yml

+46-17
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,47 @@ name: CI
33
on: ['push', 'pull_request']
44

55
jobs:
6+
build:
7+
name: Build
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Use Node.js 22.x
13+
uses: actions/setup-node@v4
14+
with:
15+
node-version: 22.x
16+
17+
- uses: actions/cache@v4
18+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
19+
with:
20+
path: '**/node_modules'
21+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
22+
restore-keys: |
23+
${{ runner.os }}-yarn-
24+
25+
- name: yarn install
26+
if: steps.yarn-cache.outputs.cache-hit != 'true' # Over here!
27+
run: yarn install --frozen-lockfile --ignore-scripts
28+
29+
- name: yarn build
30+
run: yarn build
31+
32+
env:
33+
CI: true
34+
635
lint:
736
name: Lint
837
runs-on: ubuntu-latest
938

1039
steps:
11-
- uses: actions/checkout@v3
12-
- name: Use Node.js 18.x
13-
uses: actions/setup-node@v3
40+
- uses: actions/checkout@v4
41+
- name: Use Node.js 22.x
42+
uses: actions/setup-node@v4
1443
with:
15-
node-version: 18.x
44+
node-version: 22.x
1645

17-
- uses: actions/cache@v3
46+
- uses: actions/cache@v4
1847
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
1948
with:
2049
path: '**/node_modules'
@@ -38,16 +67,16 @@ jobs:
3867

3968
strategy:
4069
matrix:
41-
node-version: [14.x, 16.x, 18.x]
70+
node-version: [18.x, 20.x, 22.x]
4271

4372
steps:
44-
- uses: actions/checkout@v3
73+
- uses: actions/checkout@v4
4574
- name: Use Node.js ${{ matrix.node-version }}
46-
uses: actions/setup-node@v3
75+
uses: actions/setup-node@v4
4776
with:
4877
node-version: ${{ matrix.node-version }}
4978

50-
- uses: actions/cache@v3
79+
- uses: actions/cache@v4
5180
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
5281
with:
5382
path: '**/node_modules'
@@ -60,7 +89,7 @@ jobs:
6089
run: yarn install --frozen-lockfile --ignore-scripts
6190

6291
- name: yarn test
63-
run: yarn test --reporters="default" --reporters="github-actions"
92+
run: yarn test --ci --reporters="default" --reporters="github-actions"
6493

6594
env:
6695
CI: true
@@ -70,13 +99,13 @@ jobs:
7099
runs-on: ubuntu-latest
71100

72101
steps:
73-
- uses: actions/checkout@v3
74-
- name: Use Node.js 18.x
75-
uses: actions/setup-node@v3
102+
- uses: actions/checkout@v4
103+
- name: Use Node.js 22.x
104+
uses: actions/setup-node@v4
76105
with:
77-
node-version: 18.x
106+
node-version: 22.x
78107

79-
- uses: actions/cache@v3
108+
- uses: actions/cache@v4
80109
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
81110
with:
82111
path: '**/node_modules'
@@ -100,8 +129,8 @@ jobs:
100129
name: Spellcheck
101130
runs-on: ubuntu-latest
102131
steps:
103-
- uses: actions/checkout@v3
104-
- uses: streetsidesoftware/cspell-action@main
132+
- uses: actions/checkout@v4
133+
- uses: streetsidesoftware/cspell-action@v6
105134
with:
106135
# Github token used to fetch the list of changed files in the commit.
107136
# Default: ${{ github.token }}

.github/workflows/publish.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: publish to npmjs
2+
on:
3+
release:
4+
types: [prereleased, released]
5+
jobs:
6+
build-and-publish:
7+
# prevents this action from running on forks
8+
if: github.repository == 'chimurai/http-proxy-middleware'
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
id-token: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: '22.x'
18+
registry-url: 'https://registry.npmjs.org'
19+
20+
- name: Install Dependencies
21+
run: yarn install
22+
23+
- name: Publish to NPM (beta)
24+
if: 'github.event.release.prerelease'
25+
run: npm publish --provenance --access public --tag beta
26+
env:
27+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
28+
29+
- name: Publish to NPM (stable)
30+
if: '!github.event.release.prerelease'
31+
run: npm publish --provenance --access public
32+
env:
33+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitpod.yml

-11
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,6 @@ tasks:
77
yarn build
88
yarn test --maxWorkers=30%
99
10-
github:
11-
# https://www.gitpod.io/docs/prebuilds/#configure-prebuilds
12-
prebuilds:
13-
master: true
14-
branches: true
15-
pullRequests: true
16-
pullRequestsFromForks: true
17-
addCheck: true
18-
addComment: false
19-
addBadge: true
20-
2110
vscode:
2211
extensions:
2312
- bierner.markdown-preview-github-styles

.husky/commit-msg

-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
3-
41
yarn commitlint --edit $1

.husky/pre-commit

-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
3-
41
yarn lint-staged

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
package-lock=false
2+
provenance=true

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"deno.enable": false,
33
"editor.codeActionsOnSave": {
4-
"source.fixAll.eslint": true
4+
"source.fixAll.eslint": "explicit"
55
},
66
"markdown.extension.toc.levels": "2..3"
77
}

CHANGELOG.md

+26-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,31 @@
11
# Changelog
22

3-
## next
3+
## [v3.0.3](https://github.com/chimurai/http-proxy-middleware/releases/tag/v3.0.3)
4+
5+
- fix(pathFilter): handle errors
6+
7+
## [v3.0.2](https://github.com/chimurai/http-proxy-middleware/releases/tag/v3.0.2)
8+
9+
- refactor(dependency): replace is-plain-obj with is-plain-object ([#1031](https://github.com/chimurai/http-proxy-middleware/pull/1031))
10+
- chore(package): upgrade to eslint v9 ([#1032](https://github.com/chimurai/http-proxy-middleware/pull/1032))
11+
- fix(logger-plugin): handle undefined protocol and hostname ([#1036](https://github.com/chimurai/http-proxy-middleware/pull/1036))
12+
13+
## [v3.0.1](https://github.com/chimurai/http-proxy-middleware/releases/tag/v3.0.1)
14+
15+
- fix(type): fix RequestHandler return type ([#980](https://github.com/chimurai/http-proxy-middleware/pull/980))
16+
- refactor(errors): improve pathFilter error message ([#987](https://github.com/chimurai/http-proxy-middleware/pull/987))
17+
- fix(logger-plugin): fix missing target port ([#989](https://github.com/chimurai/http-proxy-middleware/pull/989))
18+
- ci(package): npm package provenance ([#991](https://github.com/chimurai/http-proxy-middleware/pull/1015))
19+
- fix(logger-plugin): log target port when router option is used ([#1001](https://github.com/chimurai/http-proxy-middleware/pull/1001))
20+
- refactor: fix circular dependencies ([#1010](https://github.com/chimurai/http-proxy-middleware/pull/1010))
21+
- fix(fix-request-body): support '+json' content-type suffix ([#1015](https://github.com/chimurai/http-proxy-middleware/pull/1015))
22+
23+
## [v3.0.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v3.0.0)
24+
25+
This release contains some breaking changes.
26+
27+
Please read the V3 discussion <https://github.com/chimurai/http-proxy-middleware/discussions/768>
28+
or follow the [MIGRATION.md](https://github.com/chimurai/http-proxy-middleware/blob/master/MIGRATION.md) guide.
429

530
- feat(typescript): type improvements ([#882](https://github.com/chimurai/http-proxy-middleware/pull/882))
631
- chore(deps): update micromatch to 4.0.5

MIGRATION.md

+26-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Migration guide
22

3+
- [v3 changes and discussions](#v3-changes-and-discussions)
34
- [v2 to v3 adapter](#v2-to-v3-adapter)
45
- [`legacyCreateProxyMiddleware`](#legacycreateproxymiddleware)
56
- [v3 breaking changes](#v3-breaking-changes)
@@ -10,12 +11,20 @@
1011
- [Removed `logProvider` and `logLevel` options](#removed-logprovider-and-loglevel-options)
1112
- [Refactored proxy events](#refactored-proxy-events)
1213

14+
## v3 changes and discussions
15+
16+
See list of changes in V3:
17+
18+
<https://github.com/chimurai/http-proxy-middleware/discussions/768>
19+
1320
## v2 to v3 adapter
1421

1522
### `legacyCreateProxyMiddleware`
1623

1724
Use the adapter to use v3 with minimal changes to your v2 implementation.
1825

26+
💡 When you use `legacyCreateProxyMiddleware` it will print out console messages in run-time to guide you on how to migrate legacy configurations.
27+
1928
NOTE: `legacyCreateProxyMiddleware` will be removed in a future version.
2029

2130
```js
@@ -46,6 +55,8 @@ legacyCreateProxyMiddleware(...);
4655

4756
### Removed `req.url` patching
4857

58+
When proxy is mounted on a path, this path should be provided in the target.
59+
4960
```js
5061
// before
5162
app.use('/user', proxy({ target: 'http://www.example.org' }));
@@ -64,10 +75,13 @@ It was common to rewrite the `basePath` with the `pathRewrite` option:
6475

6576
```js
6677
// before
67-
app.use('/user', proxy({
68-
target: 'http://www.example.org'
69-
pathRewrite: { '^/user': '/secret' }
70-
}));
78+
app.use(
79+
'/user',
80+
proxy({
81+
target: 'http://www.example.org',
82+
pathRewrite: { '^/user': '/secret' },
83+
}),
84+
);
7185

7286
// after
7387
app.use('/user', proxy({ target: 'http://www.example.org/secret' }));
@@ -77,10 +91,12 @@ When proxy is mounted at the root, `pathRewrite` should still work as in v2.
7791

7892
```js
7993
// not affected
80-
app.use(proxy({
81-
target: 'http://www.example.org'
82-
pathRewrite: { '^/user': '/secret' }
83-
}));
94+
app.use(
95+
proxy({
96+
target: 'http://www.example.org',
97+
pathRewrite: { '^/user': '/secret' },
98+
}),
99+
);
84100
```
85101

86102
### Removed "shorthand" usage
@@ -89,10 +105,10 @@ Specify the `target` option.
89105

90106
```js
91107
// before
92-
createProxyMiddleware('http:/www.example.org');
108+
createProxyMiddleware('http://www.example.org');
93109

94110
// after
95-
createProxyMiddleware({ target: 'http:/www.example.org' });
111+
createProxyMiddleware({ target: 'http://www.example.org' });
96112
```
97113

98114
### Removed `context` argument

0 commit comments

Comments
 (0)