Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to use HAproxy to redirect legacy ASP requests to our ASP server like this:

global
    log         127.0.0.1 local2
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4096
    user        haproxy
    group       haproxy
    daemon
    nbproc      2

defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 4096

frontend  main 0.0.0.0:80
    acl url_legacy  path_beg        -i /wsMMC
    acl url_legacy  path_end        -i .asmx
    acl url_static  path_beg        -i /public
    acl url_static  path_end        -i .jpg .jpeg .png .gif .ico .css .zip .tgz .gz .rar .bz2 .pdf .txt .tar .wav .bmp .rtf .flv .swf .html .htm .apk .jad
    use_backend static      if url_static
    use_backend legacy      if url_legacy
    default_backend www

backend www
    balance roundrobin
    server app1 10.100.46.3:3001 check
    server app2 10.100.46.4:3001 check

backend static
    balance roundrobin
    server app1 10.100.46.3:80 check
    server app2 10.100.46.4:80 check

backend legacy
    server legacy www.legacy.com:80 check

However the server response I get is 404 - resource not found. Going directly to www.legacy.com/ws/derp.asmx returns the correct exception code (since I am using GET not POST). Any suggestions?

I tried replacing the path begin with /images and path end with .png and I can retrieve our logo file without issues.

The remote server (legacy.com) is an IIS7 Windows machine.

share|improve this question
    
What's logged by IIS for the request that 404s? –  Shane Madden Feb 24 '12 at 22:46
    
Hi Shane, I cannot find any requests in the IIS logs that would relate to this. Error 404 or otherwise. –  Lukasz Feb 25 '12 at 0:54
    
So it's sending the request to the wrong backend - can you provide the rest of the config? –  Shane Madden Feb 25 '12 at 1:05
    
Hi Shane - I posted the full config into the main question. –  Lukasz Feb 27 '12 at 16:34

1 Answer 1

The IIS server must bind to the same domain as the domain used by the proxy. In my example the HAproxy is bound to test.domain.com while the IIS only listens on domain.com. After adding test.domain.com to list of names IIS should accept the forwarding started to work.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.