@@ -49,8 +49,22 @@ export interface Options<TReq = http.IncomingMessage, TRes = http.ServerResponse
49
49
* Narrow down requests to proxy or not.
50
50
* Filter on {@link http.IncomingMessage.url `pathname`} which is relative to the proxy's "mounting" point in the server.
51
51
* Or use the {@link http.IncomingMessage `req`} object for more complex filtering.
52
+ * @link https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/pathFilter.md
53
+ * @since v3.0.0
52
54
*/
53
55
pathFilter ?: Filter < TReq > ;
56
+ /**
57
+ * Modify request paths before requests are send to the target.
58
+ * @example
59
+ * ```js
60
+ * createProxyMiddleware({
61
+ * pathRewrite: {
62
+ * '^/api/old-path': '/api/new-path', // rewrite path
63
+ * }
64
+ * });
65
+ * ```
66
+ * @link https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/pathRewrite.md
67
+ */
54
68
pathRewrite ?:
55
69
| { [ regexp : string ] : string }
56
70
| ( ( path : string , req : TReq ) => string )
@@ -68,12 +82,15 @@ export interface Options<TReq = http.IncomingMessage, TRes = http.ServerResponse
68
82
* }]
69
83
* });
70
84
* ```
85
+ * @link https://github.com/chimurai/http-proxy-middleware#plugins-array
86
+ * @since v3.0.0
71
87
*/
72
88
plugins ?: Plugin < TReq , TRes > [ ] ;
73
89
/**
74
90
* Eject pre-configured plugins.
75
91
* NOTE: register your own error handlers to prevent server from crashing.
76
92
*
93
+ * @link https://github.com/chimurai/http-proxy-middleware#ejectplugins-boolean-default-false
77
94
* @since v3.0.0
78
95
*/
79
96
ejectPlugins ?: boolean ;
@@ -90,8 +107,22 @@ export interface Options<TReq = http.IncomingMessage, TRes = http.ServerResponse
90
107
* }
91
108
* });
92
109
* ```
110
+ * @link https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/proxy-events.md
111
+ * @since v3.0.0
93
112
*/
94
113
on ?: OnProxyEvent < TReq , TRes > ;
114
+ /**
115
+ * Dynamically set the {@link Options.target `options.target`}.
116
+ * @example
117
+ * ```js
118
+ * createProxyMiddleware({
119
+ * router: async (req) => {
120
+ * return 'http://127:0.0.1:3000';
121
+ * }
122
+ * });
123
+ * ```
124
+ * @link https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/router.md
125
+ */
95
126
router ?:
96
127
| { [ hostOrPath : string ] : httpProxy . ServerOptions [ 'target' ] }
97
128
| ( ( req : TReq ) => httpProxy . ServerOptions [ 'target' ] )
@@ -104,6 +135,8 @@ export interface Options<TReq = http.IncomingMessage, TRes = http.ServerResponse
104
135
* logger: console
105
136
* });
106
137
* ```
138
+ * @link https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/logger.md
139
+ * @since v3.0.0
107
140
*/
108
141
logger ?: Logger | any ;
109
142
}
0 commit comments