When i use the vite (bottom layer is node-http-proxy) to start a http-server and proxy the request to target server, ETIMEDOUT problem occurs frequently.

Aperta
#1,622 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
javascript, node.js

Direzione di ricerca

Inizia dalla configurazione del proxy Vite segnalata e dalle richieste a /stomp e /api, quindi traccia il modo in cui node-http-proxy apre la connessione alla destinazione e gestisce ETIMEDOUT su macOS e Windows. Riproduci il comportamento nelle condizioni segnalate con HDD e rete più lenta; il lavoro è completato quando è stata identificata una causa affidabile e il comportamento risultante è stato documentato o testato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

In vite, I was trying to start a http server with following code

server: {
    open: true,
    proxy: setupProxy()
  }

const setupProxy = () => {
  const backendAddr = 'http://192.168.50.213:8180/'

  const wsOptions = {
    target: backendAddr,
    ws: true
  }
  const httpOptions = {
    target: backendAddr,
    changeOrigin: true
  }
  return {
    '/stomp': wsOptions,
    '/api': httpOptions,
    '/pub': httpOptions,
    '/docs': httpOptions
  }
}

According to the vite document, Its bottom layer uses node-http-proxy.
My problem is that my target server is sure to be accessible, but it will encounter proxy timeout problems from time to time.

Error: connect ETIMEDOUT 192.168.50.213:8180
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1300:16)
3:23:48 PM [vite] http proxy error at /stomp/info?t=1670657002883:
Error: connect ETIMEDOUT 192.168.50.213:8180
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1300:16)
3:23:48 PM [vite] http proxy error at /stomp/info?t=1670657002882:
Error: connect ETIMEDOUT 192.168.50.213:8180
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1300:16)
3:23:48 PM [vite] http proxy error at /api/settings/hiddenMenuPaths:
Error: connect ETIMEDOUT 192.168.50.213:8180

What I can offer is that this problem will not occur when my target server deploys on a ssd, which is, the access speed is very fast.
When I deploy the server on a hdd or when the network environment is more complicated, which is, the access speed is not so fast, but definitely not slow, problem returns.
All my colleagues who use Mac have this problem, but all my colleagues who use Windows don't.
Based on the above phenomenon, I doubt whether there are some special configurations for the mac version of nodejs, such as the default timeout time, fault tolerance or automatic retry mechanism, which causes frequent timeout problems when the target server apis are slightly slower.

Lingua principale
JavaScript
Stelle
14.1k
Fork
2k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di http-party/node-http-proxy

Tutte le issue di http-party/node-http-proxy

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.