Unverified Commit 267c2d29 authored by Shu Ding's avatar Shu Ding Committed by GitHub

Use 127.0.0.1 as the default host for the standalone server (#52283)

This helps getting rid of the

```
Error: connect ECONNREFUSED ::1:64696
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16) {
  errno: -61,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '::1',
  port: 64696
}
```

error for me when running the standalone server. cc @ijjk.

I'm not sure if it's related to https://github.com/http-party/node-http-proxy/issues/835.
Co-authored-by: 's avatarJJ Kasper <22380829+ijjk@users.noreply.github.com>
parent 31dee6f3
...@@ -69,7 +69,9 @@ export const createServerHandler = async ({ ...@@ -69,7 +69,9 @@ export const createServerHandler = async ({
didInitialize = true didInitialize = true
const getProxyServer = (pathname: string) => { const getProxyServer = (pathname: string) => {
const targetUrl = `http://${hostname}:${routerPort}${pathname}` const targetUrl = `http://${
hostname === 'localhost' ? '127.0.0.1' : hostname
}:${routerPort}${pathname}`
const proxyServer = httpProxy.createProxy({ const proxyServer = httpProxy.createProxy({
target: targetUrl, target: targetUrl,
changeOrigin: false, changeOrigin: false,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment