大网数据广告活动
服务器运维问答

HAProxy: forward frontend request to external backend server

· 52CE 我爱测

I want to forward requests to an external server when someone requests a subdirectory in my domain. I've got the following config but I'm still getting a 503: resolvers dns nameserver google-1 8.8.8.8:53 nameserver google-2 8.8.4…

问题原文

原帖链接 · dimiguel · CC BY-SA 4.0

I want to forward requests to an external server when someone requests a subdirectory in my domain.

I've got the following config but I'm still getting a 503:

resolvers dns
  nameserver google-1 8.8.8.8:53
  nameserver google-2 8.8.4.4:53
  hold valid 1s

frontend http-in
  maxconn 1048576

  bind *:80
  bind *:443 ssl crt /path/to/ssl

  redirect scheme https code 301 if !{ ssl_fc }

  acl is_dashboard_uri path_beg /dashboard
  use_backend surge if is_dashboard_uri

  default_backend servers

backend surge
  option forwardfor
  balance leastconn
  server surge my-path.surge.sh:443 check resolvers dns

I'm not sure what I'm doing wrong here. I have access to both the DNS server and the backend path.

Edit: here's the logs:

Jun 12 21:32:05 ion-matchmaker-load-balancer haproxy[12612]: 73.70.169.76:54627 [12/Jun/2018:21:32:05.127] http-in~ surge/surge 0/59/-1/-1/+79 503 +213 - - sC-- 4/4/0/0/3 0/0 "GET /dashboard HTTP/1.1"

已采纳解答

原帖链接 · dimiguel · CC BY-SA 4.0

The sC-- in the logs occurs when the backend is not able to fulfill a request in a timely manner.

The "timeout connect" stroke before a connection to the server could complete. When this happens in HTTP mode, the status code is likely a 503 or 504 here.

I increased the timeout on the backend and it gave the server enough time to process the request.

backend surge
  timeout connect 5000

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-06-12)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。