Bonjour,
J'ai un dédié chez OVH afin de mettre en place ma plateforme.
Les VMs en interne sont prêtes à être exploité. Afin de faire le reverse proxy, j'ai choisi de prendre HAProxy.
Cependant sur mon 1er frontend / backend, j'ai ce message :
> La page n’est pas redirigée correctement
Voici ma configuration HAProxy :
> global
> log 127.0.0.1 local0 debug
> log /dev/log local0 notice
> maxconn 1024
> chroot /var/haproxy
> uid 604
> gid 604
> daemon
> stats socket /var/run/haproxy.sock mode 666 level admin
> pidfile /var/run/haproxy.pid
> ssl-default-bind-ciphers ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:ECDHE-ECDSA-DES-CBC3-SHA:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-CHACHA20-POLY1305-D:TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256:TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256:TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256:TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256:TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256:!DSS
> ssl-default-bind-options no-tlsv11 no-sslv3 no-tlsv10 no-tls-tickets
> tune.ssl.default-dh-param 2048
> tune.maxrewrite 16384
> tune.bufsize 65535
> defaults
> log global
> mode http
> option redispatch
> option forwardfor
> retries 3
> maxconn 2000
> timeout server 60s
> timeout connect 5s
> timeout client 10s
> log-format "%ci [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
> frontend http-s-storage-domain-name
> bind *:80
> bind *:443 ssl crt /etc/haproxy/ssl/storage.domain-name.com.haproxy.pem no-sslv3
> mode http
> option httplog clf
> option forwardfor
> option http-keep-alive
> capture request header Host len 64
> capture request header Referer len 128
> capture request header User-Agent len 128
> capture request header X-Hit-Front len 128
> #timeout server 60s
> #timeout connect 5s
> acl letsencrypt-acl path_beg /.well-known/acme-challenge/
> #www to non-www
> #acl has_www hdr_beg(host) -i www
> acl storage-domain hdr(host) -i storage.domain-name.com
> # HTTP->HTTPS
> #http-request redirect code 301 prefix https://%[req.hdr(Host)] unless { ssl_fc }
> #http-request redirect scheme https if !{ ssl_fc }
> #http-request add-header X-Forwarded-Proto https if { ssl_fc }
> #http-request add-header X-Forwarded-Proto http unless { ssl_fc }
> #http-request redirect prefix https://www.%[hdr(host)] code 302 if storage-domain !has_www
> use_backend letsencrypt-backend if letsencrypt-acl
> use_backend nextcloud-storage-domain-name if storage-domain
> backend nextcloud-storage-domain-name
> default-server inter 4s
> timeout server 2h
> http-check expect status 200
> #redirect scheme https code 301 if !{ ssl_fc }
> server nextcloud 172.16.X.X:8080 cookie A check port 8080 fall 5 rise 3
> backend letsencrypt-backend
> server letsencrypt 127.0.0.1:1375 check
Configuration apache2 sur ma VM :
ServerName nextcloud.domain-name.com
ServerAlias storage.domain-name.com
ServerAdmin contact@domain-name.com
DocumentRoot /data-nextcloud/web/nextcloud
#regle htaccess
Order allow,deny
Deny from all
#regle log apache2
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from all
Require all granted
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#set home for nextcloud
Options +FollowSymlinks
AllowOverride All
Require all granted
Dav off
SetEnv HOME /data-nextcloud/web/nextcloud
SetEnv HTTP_HOME /data-nextcloud/web/nextcloud
#redirect to https
RewriteEngine on
RewriteCond %{SERVER_NAME} =storage.domain-name.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
SSLEngine on
SSLOptions +StrictRequire
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" vhost_combined
LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common
ServerAdmin contact@domain-name.com
DocumentRoot /data-nextcloud/web/nextcloud
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName nextcloud.domain-name.com
ServerAlias storage.domain-name.com
SSLCertificateFile /etc/apache2/ssl/storage.domain-name.com.cer
SSLCACertificateFile /etc/apache2/ssl/storage.domain-name.com.haproxy.pem
SSLCertificateKeyFile /etc/apache2/ssl/storage.domain-name.com.key
Options +FollowSymlinks
AllowOverride All
Require all granted
Dav off
SetEnv HOME /data-nextcloud/web/nextcloud
SetEnv HTTP_HOME /data-nextcloud/web/nextcloud
Header always set Strict-Transport-Security "max-age=15768000; preload"
Header set Referrer-Policy "strict-origin-when-cross-origin"
Header set X-Content-Type-Options "nosniff"
#Header always set X-Frame-Options "SAMEORIGIN"
SSLProtocol -all +TLSv1.3 +TLSv1.2
SSLCipherSuite TLS-CHACHA20-POLY1305-SHA256:TLS-AES-256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384
SSLHonorCipherOrder on
SSLCompression off
SSLSessionTickets off
SSLUseStapling on
SSLStaplingResponderTimeout 5
SSLStaplingReturnResponderErrors off
SSLStaplingCache shmcb:/var/run/ocsp(128000)
SSLOpenSSLConfCmd Curves X448:secp521r1:secp384r1:prime256v1
SSLOpenSSLConfCmd ECDHParameters secp384r1
SSLOpenSSLConfCmd DHParameters "/etc/ssl/certs/dhparam.pem"
Avez-vous des axes d'amélioration à me proposer ?
Je suis dans l'amélioration continue,
En vous remerciant par avance,
Hosted Private Cloud OVHcloud - [HAProxy] Problème de redirection backend
Willkommen in der OVHcloud Community
Stellen Sie Fragen, suchen Sie nach Informationen, veröffentlichen Sie Inhalte und interagieren Sie mit anderen Mitgliedern der OVHcloud Community.
Frage
[HAProxy] Problème de redirection backend
Von
Erstellungsdatum 2020-02-06 08:46:40 (edited on 2024-09-04 13:02:46) in Hosted Private Cloud OVHcloud
Positive Bewertungen (0)
5705 Ansichten
Related questions
- Intégration dans un MPLS opérateur
6731
12.05.2017 09:44
- Update des ESX et machine VEAAM
6414
14.11.2017 05:46
- Nouvelle offre PCC. Pas de SSD ?
6001
31.07.2020 08:47
- Installation de NextCloud sur OVH perso
5600
15.12.2020 19:29
- Support hubic - Impossible de supprimer des fichiers
5443
10.11.2017 20:41
- Cloud Disk Array Performance mauvaise
5403
04.05.2017 07:23
- Migrer du public cloud au private cloud
5360
17.05.2018 07:03
- OVH Healthcare, données de santé
5271
30.05.2017 02:03
- Impossible de telecharger des dossiers sur HUBIC
5128
29.05.2019 16:48
tu devrais **éditer** le titre de ton sujet et choisir la catégorie : Cloud / Dédié
tu auras des réponses adaptées
Bonjour,
J'ai pas regardé en détails la configuration HAProxy mais au niveau de apache il faut retirer la redirection HTTPS si la redirection est faite sur HAProxy.
Si vous voulez faire la redirection au niveau de apache il faut :
Dans le frontend qui gère https ajouter [code]http-request set-header X-Forwarded-Proto https[/code]
Puis côté apache le RewriteCond doit se baser dessus [code]RewriteCond %{HTTP:X-Forwarded-Proto} =http[/code]
Note : je vous conseil de faire 2 frontend : 1 pour http et un autre pour https
Cordialement, janus57
Merci !
C'est bien côté apache2 qui faisait une "boucle"
D'autres conseils ?
Bonjour,
Si tout doit être en https perso je fait la redirection dans HAProxy et ne fait rien au niveau des backends pour la redirection.
Ce qui permet aussi de filtrer au niveau de HAProxy via des ACL (par exemple je redirige que certains sites de http vers https et d'autres 0 redirections il faut directement arriver en https sinon HAProxy renvoie une erreur 503)
Cordialement, janus57