Merge pull request #16290 from nikolaik/fix/techdocs-ipv6
fix(techdocs-cli): Fix proxying to mkdocs
This commit is contained in:
@@ -127,7 +127,7 @@ export default async function serve(opts: OptionValues) {
|
||||
const httpServer = new HTTPServer(
|
||||
previewAppPath,
|
||||
port,
|
||||
opts.mkdocsPort,
|
||||
mkdocsExpectedDevAddr,
|
||||
opts.verbose,
|
||||
);
|
||||
|
||||
|
||||
@@ -23,26 +23,26 @@ export default class HTTPServer {
|
||||
private readonly proxyEndpoint: string;
|
||||
private readonly backstageBundleDir: string;
|
||||
private readonly backstagePort: number;
|
||||
private readonly mkdocsPort: number;
|
||||
private readonly mkdocsTargetAddress: string;
|
||||
private readonly verbose: boolean;
|
||||
|
||||
constructor(
|
||||
backstageBundleDir: string,
|
||||
backstagePort: number,
|
||||
mkdocsPort: number,
|
||||
mkdocsTargetAddress: string,
|
||||
verbose: boolean,
|
||||
) {
|
||||
this.proxyEndpoint = '/api/techdocs/';
|
||||
this.backstageBundleDir = backstageBundleDir;
|
||||
this.backstagePort = backstagePort;
|
||||
this.mkdocsPort = mkdocsPort;
|
||||
this.mkdocsTargetAddress = mkdocsTargetAddress;
|
||||
this.verbose = verbose;
|
||||
}
|
||||
|
||||
// Create a Proxy for mkdocs server
|
||||
private createProxy() {
|
||||
const proxy = httpProxy.createProxyServer({
|
||||
target: `http://localhost:${this.mkdocsPort}`,
|
||||
target: this.mkdocsTargetAddress,
|
||||
});
|
||||
|
||||
return (request: http.IncomingMessage): [httpProxy, string] => {
|
||||
|
||||
Reference in New Issue
Block a user