I like art! Thanks!!

2014-05-23 16:34 GMT+02:00 Baptiste <bed...@gmail.com>:

> You can set a map entry, it will erase then create the entry.
> And HAProxy will take it into account on the fly, without doing anything.
> You could even forward traffic to your webservers and let haproxy
> learn the redirect on the fly.
>
> Remember, HAProxy is art:
> https://twitter.com/malditogeek/status/243020846875152384#
>
> Baptiste
>
> On Fri, May 23, 2014 at 4:00 PM, Matt . <yamakasi....@gmail.com> wrote:
> > So when you remove a line and there is no line like it... just nothing
> > happens as it should ?
> >
> > But what if you add one that is already there ? Will it be added twice ?
> If
> > so and you do a remove will both be removed ?
> >
> >
> > 2014-05-23 15:22 GMT+02:00 Baptiste <bed...@gmail.com>:
> >>
> >> There is no reply, it is silently performed.
> >>
> >>
> >> Baptiste
> >>
> >> On Fri, May 23, 2014 at 3:07 PM, Matt . <yamakasi....@gmail.com> wrote:
> >> > Hi,
> >> >
> >> > OK, that is a very good explanation!
> >> >
> >> > It's also very flexible in my opinion.
> >> >
> >> > Does hsproxy give a reply/callback after adding/removing ? I'm not
> sure
> >> > but
> >> > I thought it did.
> >> >
> >> > I also did a reply-all this time, sorry for last time!
> >> >
> >> > Cheers,
> >> >
> >> > Matt
> >> >
> >> >
> >> > 2014-05-23 14:07 GMT+02:00 Baptiste <bed...@gmail.com>:
> >> >
> >> >> Hi Matt,
> >> >>
> >> >> I'm Ccing the ML since the answer can interest everybody here.
> >> >>
> >> >> > Thanks for you explanation... I found something indeed on the devel
> >> >> > version
> >> >> > yesterday, you can also remove this way I saw ?
> >> >>
> >> >> yes, you can delete content from a map thanks to the socket or
> through
> >> >> information found in HTTP headers.
> >> >>
> >> >> > What do you mean by filecontents on reload ?
> >> >>
> >> >> I mean that the content of the map is read from a flat file.
> >> >> If you modify running map, HAProxy only updates its memory, not the
> >> >> flat
> >> >> file.
> >> >> So after a reload, if the flat file does not contain same content as
> >> >> HAProxy's memory, then updates are lost.
> >> >>
> >> >> > What I add this was is added to memory and not to the file ?
> >> >>
> >> >> exactly
> >> >>
> >> >> > So, I need to sync the file with the memory in some way ?
> >> >>
> >> >> yes.
> >> >> This can be done easily with a tool since you can dump a map content
> >> >> from HAProxy's socket.
> >> >>
> >> >> Baptiste
> >> >>
> >> >>
> >> >> >
> >> >> >
> >> >> > 2014-05-23 10:17 GMT+02:00 Baptiste <bed...@gmail.com>:
> >> >> >
> >> >> >> Hi Matt,
> >> >> >>
> >> >> >> You have to use HAProxy 1.5.
> >> >> >> You can load redirects from a map file.
> >> >> >> Map file content, 2 columns, with on the left the reference (what
> >> >> >> you're looking from in the client request) and on the right the
> >> >> >> response to send back.
> >> >> >> domain2.com subdomain.domain1.com
> >> >> >>
> >> >> >> Then, in your frontend, simply add:
> >> >> >> http-request redirect code 302 prefix
> >> >> >> http://%[req.hdr(host),map_str(map_redirects.lst)] if {
> >> >> >> req.hdr(Host),map_str(map_redirects.lst) -m found }
> >> >> >>
> >> >> >> Content of map_redirects.lst:
> >> >> >> domain2.com subdomain.domain1.com
> >> >> >>
> >> >> >> If the domain is not listed, then HAProxy will return a 503.
> >> >> >>
> >> >> >> Here are some results:
> >> >> >> GET http://127.0.0.1:8080/ -H "Host: domain2.com"
> >> >> >>
> >> >> >> HTTP/1.1 302 Found
> >> >> >> Cache-Control: no-cache
> >> >> >> Content-length: 0
> >> >> >> Location: http://subdomain.domain1.com/
> >> >> >> Connection: close
> >> >> >>
> >> >> >>
> >> >> >> GET http://127.0.0.1:8080/blah -H "Host: domain2.com"
> >> >> >>
> >> >> >> HTTP/1.1 302 Found
> >> >> >> Cache-Control: no-cache
> >> >> >> Content-length: 0
> >> >> >> Location: http://subdomain.domain1.com/blah
> >> >> >> Connection: close
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> GET http://127.0.0.1:8080/ -H "Host: domain1.com"
> >> >> >>
> >> >> >> HTTP/1.0 503 Service Unavailable
> >> >> >> Cache-Control: no-cache
> >> >> >> Connection: close
> >> >> >> Content-Type: text/html
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> The content of the map can be updated through the HAProxy socket
> or
> >> >> >> though HTTP headers.
> >> >> >> Read the manual to know how.
> >> >> >>
> >> >> >> Bear in mind HAProxy will reset its memory with the content of the
> >> >> >> file when reloading. So it's up to you to sync the memory of
> HAProxy
> >> >> >> and the content of the file.
> >> >> >>
> >> >> >> Baptiste
> >> >> >>
> >> >> >>
> >> >> >> On Thu, May 22, 2014 at 11:08 PM, Matt . <yamakasi....@gmail.com>
> >> >> >> wrote:
> >> >> >> > Babtiste,
> >> >> >> >
> >> >> >> > I'm not able to find any solution to add such rewrites, am I
> >> >> >> > looking
> >> >> >> > wrong ?
> >> >> >> >
> >> >> >> > Cheers,
> >> >> >> >
> >> >> >> > Matt
> >> >> >> >
> >> >> >> >
> >> >> >> > 2014-05-22 16:37 GMT+02:00 Matt . <yamakasi....@gmail.com>:
> >> >> >> >
> >> >> >> >> Hi,
> >> >> >> >>
> >> >> >> >> That is nice, is that in the development version ? I didn't see
> >> >> >> >> it
> >> >> >> >> in
> >> >> >> >> 1.4
> >> >> >> >> as I'm right.
> >> >> >> >>
> >> >> >> >> I need to forward domain2.com to subdomain.domain1.com
> >> >> >> >>
> >> >> >> >> and subdomain.domain1.com may be a various of webservers that
> >> >> >> >> serve
> >> >> >> >> that
> >> >> >> >> content.
> >> >> >> >>
> >> >> >> >> Thanks!
> >> >> >> >>
> >> >> >> >> Matt
> >> >> >> >
> >> >> >> >
> >> >> >
> >> >> >
> >> >
> >> >
> >
> >
>

Reply via email to