HAproxy

HAProxy manipulate string prior to map lookup

孤人 提交于 2019-12-08 03:20:20
问题 I am pretty new to HAProxy but have the need for what seems like a fairly uncommon requirement. I need to lookup an item in a map based on the host header but I need to apply some string manipulation first. Example: Request comes in for i.domain.com I need to strip off the i. and lookup domain.com in my map. I can do this by creating a new, temp header with the value from the initial request and then replacing that value with some regex like so: http-request set-header X-Temp %[req.hdr(host)]

HAProxy redirect based on path?

元气小坏坏 提交于 2019-12-08 01:44:52
问题 I need to redirect certain paths to https - frontend secured The reason for this is that i want certain parts of my web application to only be allowed to run over https. I've figured out how to redirect all traffic by changing my HAproxy conf like this: frontend unsecured *:80 #timeout client 86400000 #redirect prefix http://domain.com code 301 mode http timeout client 120s But how can i configure it to only redirect certain sub-folder on my domain? What i would like is to redirect only the

Varnish to be used for https

青春壹個敷衍的年華 提交于 2019-12-07 20:46:38
问题 Here's the situation. I have clients over a secured network (https) that talk to multiple backends. Now, I wanted to establish a reverse proxy for majorly load balancing (based on header data or cookies) and a little caching. So, I thought varnish could be of use. But, varnish does not support ssl-connection. As I've read at many places, quoting, "Varnish does not support SSL termination natively" . But, I want every connection, ie. client-varnish and varnish-backend to be over https. I

How do I configure Tomcat and HAProxy to work with the WebSocket Framework Atmosphere?

≯℡__Kan透↙ 提交于 2019-12-07 14:32:47
问题 I have a Java application running on Tomcat7, which uses the Atmosphere Framework. Atmosphere is a Websocket Framework. I used a sample application from the Atmosphere Sample Chat. My problem is that I did not get the connectors as well as the proper configuration for my Websocket Atmosphere application running. The questions I have are: How do I have to configure my HAProxy? How do I have to configure my Tomcat server? How do I have to configure Tomcat for APR and for the NIO connector? Do I

API gateway for WebSocket

拈花ヽ惹草 提交于 2019-12-07 12:44:31
问题 I need a API gateway for my websocket application. Analyse and identify unusual requests from certain IP Quotas and Rate Limiting Statistics Free or commercial Solid performance The sub-protocol of my WebSocket is WAMP, so I am afraid there is no existing product to do the job. I intend to develop one and suppose it will work in this way: There is a proxy (NGINX or HAProxy) installed between my client application and my websocket server The proxy duplicates the request/response to another app

HAProxy reqrep not replacing string in url

巧了我就是萌 提交于 2019-12-07 11:54:37
问题 We have deprecated some software which was available under http://localhost/test and is now available under http://localhost/app/testing. We are using HAProxy 1.4 Thus, I want via haproxy, to replace all urls containing /test with /app/testing/ . I tried first with a redirect prefix in order to keep the query string, but /test wasn't removed from the url and had something like /app/testing/test/?id=x . frontend all bind 0.0.0.0:80 timeout client 86400000 acl is_test path_beg /test redirect

负载均衡之LVS、HAProxy和Nginx

。_饼干妹妹 提交于 2019-12-07 11:00:37
负载均衡(Load Balance)是应用于互联网后台系统架构设计中的各层,它将请求均匀分摊到多个操作单元上执行。 目前,在线上环境中应用较多的负载均衡器硬件有F5 BIG-IP,但是硬件设备昂贵,不如软件适应互联网公司的快速发展。最常用的负载均衡软件有LVS、HAProxy和Nginx,结合高可用软件有Heartbeat、Keepalived,可以搭建出承载海量请求的成熟架构如LVS+Keepalived、HAProxy+keepalived等. 专长 三种负载均衡软件LVS、HAProxy和Nginx的优缺点说明如下: LVS的优点: 1、性能最强、仅工作在第4层,TUN和DR模式下回包不经过LVS,保证了均衡器IO的性能受大流量的影响最小; 2、工作稳定,自身有完整的双机热备方案,如LVS+Keepalived和LVS+Heartbeat; 3、应用范围比较广,可以对所有应用做负载均衡; LVS的缺点: 1、软件本身不支持正则处理,不能做动静分离,这就凸显了Nginx/HAProxy+Keepalived的优势。 2、配置性比较低,如果网站应用比较庞大,配置和维护过程就比较麻烦。 HAProxy的优点: 1、HAProxy是支持虚拟主机的,可以工作在4、7层(支持多网段); 2、支持url检测后端的服务器; 3、它跟LVS一样,本身仅仅就只是一款负载均衡软件

Match haproxy path using path_reg

ⅰ亾dé卋堺 提交于 2019-12-07 09:04:24
问题 I'm trying to match urls like: /rivers/1, /rivers/2adsfs, /rivers/sdfd2d with: acl rivers_show path_reg ^/rivers/\w+/? But that does seem to work. Anyone know why? 回答1: HAproxy's regex does not include \w as a character class. Keep in mind regex is one of the worst performing ACL matches. You may want to look into use something like this instead, although its its not exactly the same. acl path_beg /rivers/ 回答2: You can use the below the regex to match the give acl rivers_show path_reg -i ^\

Wordpress on Openshift, very slow to respond

て烟熏妆下的殇ゞ 提交于 2019-12-07 07:05:10
问题 I've just moved my Wordpress website on OpenShift PAAS ecosystem, on a scalable PHP cartridge. But I immediately noticed the website is really slow to respond - around 3000/4000 milliseconds. BUT, when it starts to respond, the page loading/rendering is absolutely fast. here's the url: http://gabrielebaldassarre.com just to give you a comparison, this static website is hosted on the same AWS Region: http://extras.gabrielebaldassarre.com/tos5-4 For that reason, I pointed this bottleneck to the

Can I have sticky sessions with HAProxy and socket.io with authentication?

有些话、适合烂在心里 提交于 2019-12-07 06:54:45
问题 I have several instances of socket.io with authentication running under HAProxy and I need to force that the authentication request and the socket connection go to the same instance. I've set up HAProxy based on this answer to a SO question with some modifications as so: global maxconn 4096 # Total Max Connections. This is dependent on ulimit nbproc 2 defaults mode http frontend all 0.0.0.0:80 timeout client 86400000 default_backend www_backend acl is_websocket hdr(Upgrade) -i WebSocket acl