Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
| resume-technique:reverse-proxy:reverse-proxy-main [25/05/2025 22:29] – fail2ban will not work with iptables - work in progress Fabien Duchaussois | resume-technique:reverse-proxy:reverse-proxy-main [13/02/2026 19:50] (Version actuelle) – Daneel Olivaw | ||
|---|---|---|---|
| Ligne 181: | Ligne 181: | ||
| server { | server { | ||
| # a very simple reverse proxy to port 80 : forcing https and redirect will be handle by upstream | # a very simple reverse proxy to port 80 : forcing https and redirect will be handle by upstream | ||
| - | | + | |
| - | listen [::]:80 ; | + | listen [::]:80 ; |
| - | server_name subdomain1.mydomain.org subdomain2.mydomain.org; | + | server_name subdomain1.mydomain.org subdomain2.mydomain.org; |
| - | access_log / | + | access_log / |
| - | error_log / | + | error_log / |
| - | + | ||
| - | | + | |
| - | # handle real ip and send it to backend | + | # handle real ip, and send request |
| - | | + | include proxy.conf; |
| - | | + | proxy_set_header X-Real-IP $remote_addr; |
| - | | + | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| - | | + | proxy_pass http://_REPLACE_WITH_BACKEND_IP_OR_HOST_/; # backend application server internal |
| } | } | ||
| } | } | ||
| Ligne 258: | Ligne 256: | ||
| | | ||
| # Manage real ip from proxy protocol to get original client ip | # Manage real ip from proxy protocol to get original client ip | ||
| - | # Please Replace [REVERSEPROXY_IP] with inernal | + | # Please Replace [REVERSEPROXY_IP] with internal |
| set_real_ip_from [REVERSEPROXY_IP]; | set_real_ip_from [REVERSEPROXY_IP]; | ||
| real_ip_header proxy_protocol; | real_ip_header proxy_protocol; | ||
| Ligne 281: | Ligne 279: | ||
| <code apache> | <code apache> | ||
| - | # Please Replace [REVERSEPROXY_IP] with inernal | + | # Please Replace [REVERSEPROXY_IP] with internal |
| RemoteIPHeader X-Forwarded-For | RemoteIPHeader X-Forwarded-For | ||
| RemoteIPInternalProxy [REVERSEPROXY_IP]/ | RemoteIPInternalProxy [REVERSEPROXY_IP]/ | ||
| Ligne 314: | Ligne 312: | ||
| We assume that a reverse proxy is configured as described above to proxy to Yunohost. For security purpose, for tracing connexion, configuration is simply modified to get browser real IP with X-Real-IP headers. | We assume that a reverse proxy is configured as described above to proxy to Yunohost. For security purpose, for tracing connexion, configuration is simply modified to get browser real IP with X-Real-IP headers. | ||
| - | First, create a custom snippet. Please Replace [REVERSEPROXY_IP] with inernal | + | First, create a custom snippet. Please Replace [REVERSEPROXY_IP] with internal |
| / | / | ||
| Ligne 326: | Ligne 324: | ||
| </ | </ | ||
| - | In all nginx configuration file, simply | + | In all nginx configuration file, include this snippet in server directive on port 80 : |
| <code nginx> | <code nginx> | ||
| server { | server { | ||
| listen 80; | listen 80; | ||
| listen [::]:80; | listen [::]:80; | ||
| - | server_name yunohost.mydomain.test; | + | server_name |
| # YunoHost behind http Reverse Proxy | # YunoHost behind http Reverse Proxy | ||
| Ligne 349: | Ligne 347: | ||
| - | Create a custom snippet. Please Replace [YUNOHOST_INTERFACE_IP] with internal IPV4 of YunoHost interface listening on https behind Reverse Proxy. Please Replace [REVERSEPROXY_IP] with inernal | + | Create a custom snippet. Please Replace [YUNOHOST_INTERFACE_IP] with internal IPV4 of YunoHost interface listening on https behind Reverse Proxy. Please Replace [REVERSEPROXY_IP] with internal |
| / | / | ||
| Ligne 361: | Ligne 359: | ||
| # Manage real ip from proxy protocol to get original client ip | # Manage real ip from proxy protocol to get original client ip | ||
| # for interface using proxy_protocol | # for interface using proxy_protocol | ||
| - | # Please Replace [REVERSEPROXY_IP] with inernal | + | # Please Replace [REVERSEPROXY_IP] with internal |
| set_real_ip_from [REVERSEPROXY_IP]; | set_real_ip_from [REVERSEPROXY_IP]; | ||
| real_ip_header proxy_protocol; | real_ip_header proxy_protocol; | ||