@@ -28,6 +28,11 @@ import {
2828 withSerializedCallbackBuffers
2929} from '../../serialization/body-serialization' ;
3030import { ProxyConfig } from '../proxy-config' ;
31+ import {
32+ ForwardingOptions ,
33+ PassThroughHandlerConnectionOptions ,
34+ PassThroughLookupOptions
35+ } from '../passthrough-handling-definitions' ;
3136
3237/*
3338This file defines request handler *definitions*, which includes everything necessary to define
@@ -446,100 +451,7 @@ export interface PassThroughResponse {
446451 body : CompletedBody ;
447452}
448453
449- export interface ForwardingOptions {
450- targetHost : string ,
451- // Should the host (H1) or :authority (H2) header be updated to match?
452- updateHostHeader ?: true | false | string // Change automatically/ignore/change to custom value
453- }
454-
455- export interface PassThroughLookupOptions {
456- /**
457- * The maximum time to cache a DNS response. Up to this limit,
458- * responses will be cached according to their own TTL. Defaults
459- * to Infinity.
460- */
461- maxTtl ?: number ;
462- /**
463- * How long to cache a DNS ENODATA or ENOTFOUND response. Defaults
464- * to 0.15.
465- */
466- errorTtl ?: number ;
467- /**
468- * The primary servers to use. DNS queries will be resolved against
469- * these servers first. If no data is available, queries will fall
470- * back to dns.lookup, and use the OS's default DNS servers.
471- *
472- * This defaults to dns.getServers().
473- */
474- servers ?: string [ ] ;
475- }
476-
477- export interface PassThroughHandlerOptions {
478- /**
479- * The forwarding configuration for the passthrough rule.
480- * This generally shouldn't be used explicitly unless you're
481- * building rule data by hand. Instead, call `thenPassThrough`
482- * to send data directly or `thenForwardTo` with options to
483- * configure traffic forwarding.
484- */
485- forwarding ?: ForwardingOptions ,
486-
487- /**
488- * A list of hostnames for which server certificate and TLS version errors
489- * should be ignored (none, by default).
490- *
491- * If set to 'true', HTTPS errors will be ignored for all hosts. WARNING:
492- * Use this at your own risk. Setting this to `true` can open your
493- * application to MITM attacks and should never be used over any network
494- * that is not completed trusted end-to-end.
495- */
496- ignoreHostHttpsErrors ?: string [ ] | boolean ;
497-
498- /**
499- * An array of additional certificates, which should be trusted as certificate
500- * authorities for upstream hosts, in addition to Node.js's built-in certificate
501- * authorities.
502- *
503- * Each certificate should be an object with either a `cert` key and a string
504- * or buffer value containing the PEM certificate, or a `certPath` key and a
505- * string value containing the local path to the PEM certificate.
506- */
507- trustAdditionalCAs ?: Array < { cert : string | Buffer } | { certPath : string } > ;
508-
509- /**
510- * A mapping of hosts to client certificates to use, in the form of
511- * `{ key, cert }` objects (none, by default)
512- */
513- clientCertificateHostMap ?: {
514- [ host : string ] : { pfx : Buffer , passphrase ?: string }
515- } ;
516-
517- /**
518- * Upstream proxy configuration: pass through requests via this proxy.
519- *
520- * If this is undefined, no proxy will be used. To configure a proxy
521- * provide either:
522- * - a ProxySettings object
523- * - a callback which will be called with an object containing the
524- * hostname, and must return a ProxySettings object or undefined.
525- * - an array of ProxySettings or callbacks. The array will be
526- * processed in order, and the first not-undefined ProxySettings
527- * found will be used.
528- *
529- * When using a remote client, this parameter or individual array
530- * values may be passed by reference, using the name of a rule
531- * parameter configured in the admin server.
532- */
533- proxyConfig ?: ProxyConfig ;
534-
535- /**
536- * Custom DNS options, to allow configuration of the resolver used
537- * when forwarding requests upstream. Passing any option switches
538- * from using node's default dns.lookup function to using the
539- * cacheable-lookup module, which will cache responses.
540- */
541- lookupOptions ?: PassThroughLookupOptions ;
542-
454+ export interface PassThroughHandlerOptions extends PassThroughHandlerConnectionOptions {
543455 /**
544456 * Whether to simulate connection errors back to the client.
545457 *
0 commit comments