ELB背后的Haproxy [英] Haproxy behind ELB

查看:282
本文介绍了ELB背后的Haproxy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有HAproxy在AWS ELB后面.一旦删除ELB,就可以获取自定义错误页面.但是,在Haproxy前面使用ELB时,我得到HTTP/1.1 504 GATEWAY_TIMEOUT内容长度:0连接:keep-alive.

I have HAproxy is behind an AWS ELB. As soon as i remove the ELB, i can get the custom error page. but, with ELB in the front of Haproxy, i get HTTP/1.1 504 GATEWAY_TIMEOUT Content-Length: 0 Connection: keep-alive.

有人可以告诉我发生了什么吗?谢谢

Can anyone tell me what is going on please? Thanks

错误文件:

HTTP/1.0 403 Forbidden
Cache-Control: no-cache
Connection: close
Content-Type: text/html

<html><body><h1>403 Forbidden</h1>
Request forbidden by administrative rules.
</body></html>

推荐答案

我和一个同事遇到了同样的问题.在收到超时信息并阅读了此类HTTP代码的Amazon定义后,我进入了我的错误文件格式错误"的提示.经过大量尝试,我们设法发现错误文件"header"上的CL-RF(新行)有些有趣.

Me and a coworker just had the same problem. After receiving the timeouts, and reading amazon definition for this type of http code, i got in my head my error file was "malformed". After a lot of trys, we managed to discover that there is something funny with the CL-RF (new lines) on the error file "header".

我从其git( https://raw.githubusercontent.com/haproxy/haproxy/60220bbc4b6b3c4279d3c96232cf2c2461ecc55e/examples/errorfiles/503.http ),并且在vi(m)上打开时,标头上带有^ M(CR)标记(所有内容)在身体之前,包括分隔它们的空行).如果您无法下载它,则可以将其(仅在顶部)写在写字板或类似的东西(DOS)上,然后将其发送给您的UNIX机器.

I downloaded HaProxy default file from their git (https://raw.githubusercontent.com/haproxy/haproxy/60220bbc4b6b3c4279d3c96232cf2c2461ecc55e/examples/errorfiles/503.http) and when you open it on vi(m) it has a ^M (CR) sign on the headers(everything before the body, including the empty line separating them). If you cant download it, you could just write it (just the top part) on wordpad or something like it (dos) and then send it to you unix machine.

所以我用他们的标题写了我的文件,现在一切正常. 干杯.

So i wrote my on file using their header and now everything works fine. Cheers.

这篇关于ELB背后的Haproxy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆