[HAProxy] Reverse proxy avec redirection selon uri

Reverse proxy avec redirection selon uri [HAProxy] - réseaux et sécurité - Linux et OS Alternatifs

Marsh Posté le 09-07-2016 à 16:01:25    

Bonjour,
 
En cours de remplacement de NGINX par HAProxy en tant que Reverse proxy, je me heurte à la problématique que ce dernier ne redirige pas les requêtes selon les URI tapées.
En effet, je voudrais rendre accessible les interfaces de mon NAS, de SABNzbd, TVHeadend, etc... de l'extérieur en tapant une URI spécifique au lieu de devoir ouvrir le port correspondant sur la box.
 
Ex: mondomaine.fr/dsm
mondomaine.fr/tvheadend
mondomaine.fr/sabnzbd
 
J'ai réussit à faire la redirection http > https avec prise en charge d'un certificat Let's Encrypt mais pas moyen de rediriger les requêtes vers les WebUI...
 
Voici mon haproxy.conf :
 

Citation :


global
        log /dev/log    local0
        log /dev/log    local1 notice
        chroot /var/lib/haproxy
        stats socket /run/haproxy/admin.sock mode 660 level admin
        stats timeout 30s
        user haproxy
        group haproxy
        daemon
        maxconn 2048
        tune.ssl.default-dh-param 2048
 
        # Default SSL material locations
        ca-base /etc/ssl/certs
        crt-base /etc/ssl/private
 
        # Default ciphers to use on SSL-enabled listening sockets.
        # For more information, see ciphers(1SSL). This list is from:
        # https://hynek.me/articles/hardening [...] l-ciphers/
        # ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
        ssl-default-bind-ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:@STRENGTH
        ssl-default-bind-options no-sslv3
 
defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        timeout connect 5000
        timeout client  50000
        timeout server  50000
        errorfile 400 /etc/haproxy/errors/400.http
        errorfile 403 /etc/haproxy/errors/403.http
        errorfile 408 /etc/haproxy/errors/408.http
        errorfile 500 /etc/haproxy/errors/500.http
        errorfile 502 /etc/haproxy/errors/502.http
        errorfile 503 /etc/haproxy/errors/503.http
        errorfile 504 /etc/haproxy/errors/504.http
        option forwardfor
        option http-server-close
        option redispatch
 
frontend http-in
        bind *:80
 
        # Redirect http trafic to https
        redirect scheme https if !{ ssl_fc }
 
        # Redirect to default backend
        default_backend error
 
frontend https-in
        bind *:443 ssl crt /etc/haproxy/certs/mon.domaine.fr.pem
 
        # ACLs
        acl letsencrypt-acl path_beg /.well-known/acme-challenge/
        use_backend letsencrypt-backend if letsencrypt-acl
 
        acl domain-acl hdr_end(host) -i mon.domaine.fr
 
        acl dsm-acl path_beg -i /dsm
        use_backend dsm-backend if dsm-acl domain-acl
 
        acl sabnzbd-acl path_beg -i /sabnzbd
        use_backend sabnzbd-backend if sabnzbd-acl domain-acl
 
        # Redirect to default backend
        default_backend error
 
backend dsm-backend
        server claptrap 192.168.1.183:5000
 
backend sabnzbd-backend
        server claptrap 192.168.1.183:8989
 
backend box-backend
        server box 192.168.1.1:80
 
backend letsencrypt-backend
        server letsencrypt 127.0.0.1:54321
 
backend error
        errorfile 403 /etc/haproxy/errors/403.http


 
A chaque fois, je me prend un beau "Erreur 503" dans la courge...
 
Quelqu'un aurait-il une idée de comment faire ? sachant que je ne veux pas utiliser de sous domaines car ça va être galère au niveau du certificat.
 
(Tout ce beau monde tourne sur un Rpi2)
 
Merci !


Message édité par Bocal83 le 12-07-2016 à 16:26:30
Reply

Marsh Posté le 09-07-2016 à 16:01:25   

Reply

Marsh Posté le 12-07-2016 à 16:27:03    

Up ?

Reply

Marsh Posté le 12-07-2016 à 16:34:31    

Je dirais que le haproxy n'arrive pas à joindre les serveurs ? Pourquoi ne pas regarder la page de statistique du haproxy pour voir si tout est au vert ?


---------------
Le Rock c'est la colle qui tient l'univers en place, si cette jointure n'existait pas, la vie n'aurais pas de sens :D
Reply

Marsh Posté le 15-07-2016 à 13:45:31    

En fait, j'ai fait une ACL et et un backend pour accéder à la page de stats et même celle-ci ne s'affiche pas...

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed