Re: Mixed TCP and HTTP switching

2010-06-09 Thread Laurie Young
Hi

Thanks This worked really well. Got the configuration we wanted up and
running in about 10 mins.

Unfortunately the plan turned out to not work due to other issues (not
haproxy related), so I will instead be perusing a different config, where I
will care more about max number of connections to one load balancing box.
Any questions on that I will send in that thread :-)

laurie

On 4 June 2010 11:30, Willy Tarreau w...@1wt.eu wrote:

 On Fri, Jun 04, 2010 at 10:45:02AM +0100, Laurie Young wrote:
  Thanks - I'm going to give this a try - but I can't find the git url to
  access the latest source so I can try building 1.4.7 :-(

 This one will do the job :

   haproxy.1wt.eu/download/1.4/src/snapshot/

  Sorry if i'm being dumb, my excuse is it's a Friday

 hehe apparently fridays have the same effect everywhere :-)

 Willy




-- 
Dr Laurie Young
Scrum Master
New Bamboo

Follow me on twitter: @wildfalcon
Follow us on twitter:  @newbamboo

Creating fresh, flexible and fast-growing web applications is our passion.


3rd Floor, Gensurco House,
46A Rosebery Avenue, London, EC1R 4RP

http://www.new-bamboo.co.uk


Re: Mixed TCP and HTTP switching

2010-06-04 Thread Willy Tarreau
On Wed, Jun 02, 2010 at 04:18:33PM +0100, Laurie Young wrote:
 Hi everyone
 
 I have a problem, and I'm not sure if HAProxy can solve it
 
 I have a range of different requests coming in on a server to port 80, and
 am using HAProxy to switch them to the relevant back end servers.
 
 Most of these requests are HTTP requests and I have layer 7 mode working
 fine, doing everything i need
 
 Now I have to also send a tcp request though the same port. I need HAProxy
 to detect if it is a tcp request, and if so route it to server 1, otherwise
 parse the HTTP and work out which server to use based on the HTTP content
 
 Is this possible?

Yes this is possible with version 1.4. For this you need to have a TCP
frontend and an HTTP backend. Using tcp inspection rules, you define
how long you wait for an HTTP request. If a valid HTTP request comes
in time, you switch to the HTTP backend. If none comes in time, of if
the traffic is not HTTP, then you use the TCP backend. Some people use
this to open SSH on port 80 or 443 ;-)

However there are some drawbacks. Since the logs are defined by the
frontend, you won't benefit from HTTP logging, you'll only have TCP
logging.

Also, if you want to try this, you should upgrade to 1.4.7 (which is
not yet released but available as a snapshot) because it fixes an
issue with the HTTP protocol detection. One field was not properly
initialized, so once HTTP was detected on a connection, it was likely
that further connections would be detected as HTTP too.

Example of usage :

frontend 
bind :80
mode tcp
option tcplog
tcp-request inspect-delay 5s
tcp-request content accept if HTTP
use_backend http_backend if HTTP
default_backend tcp_backend

   backend tcp_backend
# tcp-only config

   backend http_backend
# http-only config
mode http

Regards,
Willy




Re: Mixed TCP and HTTP switching

2010-06-04 Thread Laurie Young
Excellent - this may be what we need

Can I do further http swittching in the backend (based on hostnames) or can
this only be done in the front end?

On 4 June 2010 08:56, Willy Tarreau w...@1wt.eu wrote:

 On Wed, Jun 02, 2010 at 04:18:33PM +0100, Laurie Young wrote:
  Hi everyone
 
  I have a problem, and I'm not sure if HAProxy can solve it
 
  I have a range of different requests coming in on a server to port 80,
 and
  am using HAProxy to switch them to the relevant back end servers.
 
  Most of these requests are HTTP requests and I have layer 7 mode working
  fine, doing everything i need
 
  Now I have to also send a tcp request though the same port. I need
 HAProxy
  to detect if it is a tcp request, and if so route it to server 1,
 otherwise
  parse the HTTP and work out which server to use based on the HTTP content
 
  Is this possible?

 Yes this is possible with version 1.4. For this you need to have a TCP
 frontend and an HTTP backend. Using tcp inspection rules, you define
 how long you wait for an HTTP request. If a valid HTTP request comes
 in time, you switch to the HTTP backend. If none comes in time, of if
 the traffic is not HTTP, then you use the TCP backend. Some people use
 this to open SSH on port 80 or 443 ;-)

 However there are some drawbacks. Since the logs are defined by the
 frontend, you won't benefit from HTTP logging, you'll only have TCP
 logging.

 Also, if you want to try this, you should upgrade to 1.4.7 (which is
 not yet released but available as a snapshot) because it fixes an
 issue with the HTTP protocol detection. One field was not properly
 initialized, so once HTTP was detected on a connection, it was likely
 that further connections would be detected as HTTP too.

 Example of usage :

frontend 
bind :80
mode tcp
option tcplog
tcp-request inspect-delay 5s
tcp-request content accept if HTTP
use_backend http_backend if HTTP
default_backend tcp_backend

   backend tcp_backend
# tcp-only config

   backend http_backend
# http-only config
mode http

 Regards,
 Willy




-- 
Dr Laurie Young
Scrum Master
New Bamboo

Follow me on twitter: @wildfalcon
Follow us on twitter:  @newbamboo

Creating fresh, flexible and fast-growing web applications is our passion.


3rd Floor, Gensurco House,
46A Rosebery Avenue, London, EC1R 4RP

http://www.new-bamboo.co.uk


Re: Mixed TCP and HTTP switching

2010-06-04 Thread Laurie Young
Thanks - I'm going to give this a try - but I can't find the git url to
access the latest source so I can try building 1.4.7 :-(

Sorry if i'm being dumb, my excuse is it's a Friday

On 4 June 2010 08:56, Willy Tarreau w...@1wt.eu wrote:

 On Wed, Jun 02, 2010 at 04:18:33PM +0100, Laurie Young wrote:
  Hi everyone
 
  I have a problem, and I'm not sure if HAProxy can solve it
 
  I have a range of different requests coming in on a server to port 80,
 and
  am using HAProxy to switch them to the relevant back end servers.
 
  Most of these requests are HTTP requests and I have layer 7 mode working
  fine, doing everything i need
 
  Now I have to also send a tcp request though the same port. I need
 HAProxy
  to detect if it is a tcp request, and if so route it to server 1,
 otherwise
  parse the HTTP and work out which server to use based on the HTTP content
 
  Is this possible?

 Yes this is possible with version 1.4. For this you need to have a TCP
 frontend and an HTTP backend. Using tcp inspection rules, you define
 how long you wait for an HTTP request. If a valid HTTP request comes
 in time, you switch to the HTTP backend. If none comes in time, of if
 the traffic is not HTTP, then you use the TCP backend. Some people use
 this to open SSH on port 80 or 443 ;-)

 However there are some drawbacks. Since the logs are defined by the
 frontend, you won't benefit from HTTP logging, you'll only have TCP
 logging.

 Also, if you want to try this, you should upgrade to 1.4.7 (which is
 not yet released but available as a snapshot) because it fixes an
 issue with the HTTP protocol detection. One field was not properly
 initialized, so once HTTP was detected on a connection, it was likely
 that further connections would be detected as HTTP too.

 Example of usage :

frontend 
bind :80
mode tcp
option tcplog
tcp-request inspect-delay 5s
tcp-request content accept if HTTP
use_backend http_backend if HTTP
default_backend tcp_backend

   backend tcp_backend
# tcp-only config

   backend http_backend
# http-only config
mode http

 Regards,
 Willy




-- 
Dr Laurie Young
Scrum Master
New Bamboo

Follow me on twitter: @wildfalcon
Follow us on twitter:  @newbamboo

Creating fresh, flexible and fast-growing web applications is our passion.


3rd Floor, Gensurco House,
46A Rosebery Avenue, London, EC1R 4RP

http://www.new-bamboo.co.uk


Mixed TCP and HTTP switching

2010-06-02 Thread Laurie Young
Hi everyone

I have a problem, and I'm not sure if HAProxy can solve it

I have a range of different requests coming in on a server to port 80, and
am using HAProxy to switch them to the relevant back end servers.

Most of these requests are HTTP requests and I have layer 7 mode working
fine, doing everything i need

Now I have to also send a tcp request though the same port. I need HAProxy
to detect if it is a tcp request, and if so route it to server 1, otherwise
parse the HTTP and work out which server to use based on the HTTP content

Is this possible?

Laurie

-- 
Dr Laurie Young
Scrum Master
New Bamboo

Follow me on twitter: @wildfalcon
Follow us on twitter:  @newbamboo

Creating fresh, flexible and fast-growing web applications is our passion.


3rd Floor, Gensurco House,
46A Rosebery Avenue, London, EC1R 4RP

http://www.new-bamboo.co.uk