Skip to content

Commit

Permalink
inline httpproxy usage (vercel#41330)
Browse files Browse the repository at this point in the history
Same as vercel#41322 we inline the usage of this module because it's heavy and not always used on regular servers + not used at all on minimal mode

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
  • Loading branch information
feedthejim authored and Kikobeats committed Oct 24, 2022
1 parent ef9724e commit 2e3a909
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/next/server/next-server.ts
Expand Up @@ -50,7 +50,6 @@ import {
import { recursiveReadDirSync } from './lib/recursive-readdir-sync'
import { format as formatUrl, UrlWithParsedQuery } from 'url'
import compression from 'next/dist/compiled/compression'
import HttpProxy from 'next/dist/compiled/http-proxy'
import { getPathMatch } from '../shared/lib/router/utils/path-match'
import { createHeaderRoute, createRedirectRoute } from './server-route-utils'
import getRouteFromAssetPath from '../shared/lib/router/utils/get-route-from-asset-path'
Expand Down Expand Up @@ -703,6 +702,8 @@ export default class NextNodeServer extends BaseServer {
parsedUrl.search = stringifyQuery(req, query)

const target = formatUrl(parsedUrl)
const HttpProxy =
require('next/dist/compiled/http-proxy') as typeof import('next/dist/compiled/http-proxy')
const proxy = new HttpProxy({
target,
changeOrigin: true,
Expand Down

0 comments on commit 2e3a909

Please sign in to comment.