import { IChassisFeature, IOperation, IChassisContext } from "../interfaces"; import { Handler } from "express-serve-static-core"; /** * HTTP Reverse Proxy * ------------------ * Attach a remote endpoint to an OpenAPI resource * The implementation of a HTTP Proxy plugin using the node-http-proxy package. * * See https://github.com/nodejitsu/node-http-proxy * * TODO: integrate with Vault to retrieve secrets and inject into egress request via header/params/etc. * */ export default class proxy implements IChassisFeature { name: string; title: string; proxyServer: any; constructor(); /** * plugin to proxy requests to a remote HTTP endpoint * * @param context * @param options * @returns {TargetEndpoint} */ fn(operation: IOperation, _options: any): Function; /** * Create express middleware that forwards a request to a remote endpoint * * @param context * @param options * @param proxyPath * @returns {Function} * @constructor */ proxy_middleware: (context: IChassisContext, _options: any, oper: IOperation) => Handler; _target_options(options: any): any; /** * If enabled, copy the incoming JWT to the proxy request. * Otherwise, ensure the JWT is removed. * * @param context * @param options * @param req * @param proxyReq */ reuseJWT: (context: IChassisContext, options: any, req: any, proxyReq: any) => void; useCredentials(_context: IChassisContext, _options: any, _req: any, proxyReq: any): boolean; respond(contentType: string, proxyReq: any, req: any): void; }