Skip to main content

Plugin Utilities

Creates a proxy middleware which proxies the given route to the given port. Useful for plugins which start their own servers but should be accessible via the main Vendure url.

Example

Ts
// Example usage in the `configuration` method of a VendurePlugin.// Imagine that we have started a Node server on port 5678// running some service which we want to access via the `/my-plugin/`// route of the main Vendure server.@VendurePlugin({  configuration: (config: Required<VendureConfig>) => {      config.apiOptions.middleware.push({          handler: createProxyHandler({              label: 'Admin UI',              route: 'my-plugin',              port: 5678,          }),          route: 'my-plugin',      });      return config;  }})export class MyPlugin {}
Signature
function createProxyHandler(options: ProxyOptions): RequestHandler

Parameters

options

parameterProxyOptions

Options to configure proxy middleware via createProxyHandler.

Signature
interface ProxyOptions {    label: string;    route: string;    port: number;    hostname?: string;    basePath?: string;}

label

propertystring

A human-readable label for the service which is being proxied. Used to generate more informative logs.

route

propertystring

The route of the Vendure server which will act as the proxy url.

port

propertynumber

The port on which the service being proxied is running.

hostname

propertystring
Default:'localhost'

The hostname of the server on which the service being proxied is running.

basePath

propertystring

An optional base path on the proxied server.

Was this chapter helpful?
Report Issue
Edited Feb 3, 2026·Edit this page