DavidS
DavidS

Reputation: 1690

HAproxy - Proxies the whole IP

In order to test every possible solution to get Socket.io working with a parallel Apache installation, I have now installed HAproxy that listens on port 80. It proxies everything to Apache, unless the hostname equals io.server.com.

We have two IPs connected to our server: 1 is for SSL, the other for all the NON-SSL subdomains we have. I have created the io.server.com subdomain to point to that NON-SSL IP-address. However, the following this occurs:

  1. A visit to regular_http.server.com results in Apache handling that sub domain (OK)
  2. A visit to io.server.com results in "Welcome to Socket.io" (OK)
  3. Next visit to regular_http.example.com results in "Welcome to Socket.io"

Why is HAproxy sending requests from a subdomain not configured to go to Socket.io, to Socket.io ? Yes, the two sub domains share the IP, but is HAproxy really proxying the whole IP under one? What is then the point with setting up ACLs based on host name?

Here's my configuration:

global
    daemon
    maxconn 4096
    user haproxy
    group haproxy

defaults
    log global

#this frontend interface receives the incoming http requests
frontend http-in
    mode http
    bind *:80
    timeout client 86400000
    #default behavior sends the requests to apache
    default_backend www_backend
    #when "io.test.tld" is matched, an acl I call arbitrarily
    # "websocket" triggers
    acl websocket hdr_end(host) -i io.server.com
    use_backend node_backend if websocket

Thank you!

Upvotes: 0

Views: 359

Answers (1)

DavidS
DavidS

Reputation: 1690

This problem was solved using the option http-server-close configuration value in HAproxy.

Upvotes: 1

Related Questions