Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ be streamed directly to the destination._

An URL (including protocol) that represents the target server to use for proxying.

It can be an array of URLs, if you want to use [`undici.BalancedPool`](https://undici.nodejs.org/#/docs/api/BalancedPool) (`upstream` is compatible with [`base`](https://github.com/fastify/fastify-reply-from?tab=readme-ov-file#base) option).

### `prefix`

The prefix to mount this plugin on. All the requests to the current server starting with the given prefix will be proxied to the provided upstream.
Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,10 @@ async function fastifyHttpProxy (fastify, opts) {

const internalRewriteLocationHeader = opts.internalRewriteLocationHeader ?? true
const oldRewriteHeaders = (opts.replyOptions || {}).rewriteHeaders
const maxRetriesOn503 = opts.maxRetriesOn503
const replyOpts = Object.assign({}, opts.replyOptions, {
rewriteHeaders
rewriteHeaders,
maxRetriesOn503
})
fromOpts.rewriteHeaders = rewriteHeaders

Expand Down
2 changes: 1 addition & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ declare namespace fastifyHttpProxy {
) => string

export interface FastifyHttpProxyOptions extends FastifyReplyFromOptions {
upstream: string;
upstream: string | string[];
prefix?: string;
rewritePrefix?: string;
proxyPayloads?: boolean;
Expand Down
Loading