|
|
@ -98,39 +98,34 @@ The following configuration works for Apache (without HTTPS): |
|
|
|
|
|
|
|
|
|
|
|
### HAProxy |
|
|
|
### HAProxy |
|
|
|
|
|
|
|
|
|
|
|
The following configuration works for HAProxy 1.7 (HTTPS with HTTP |
|
|
|
The following configuration works for HAProxy (HTTP and HTTPS): |
|
|
|
redirection): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```haproxy |
|
|
|
```haproxy |
|
|
|
frontend https |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Make sure that we are in HTTP mode so that we can rewrite headers |
|
|
|
defaults |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Use HTTP protocole |
|
|
|
mode http |
|
|
|
mode http |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
frontend https |
|
|
|
|
|
|
|
|
|
|
|
# Listen on the HTTPS and HTTP ports |
|
|
|
# Listen on the HTTPS and HTTP ports |
|
|
|
bind :80 |
|
|
|
bind :80 |
|
|
|
bind :443 ssl crt /etc/haproxy/cert_key.pem |
|
|
|
bind :443 ssl crt /etc/haproxy/certs/cert_key.pem |
|
|
|
|
|
|
|
|
|
|
|
# Some useful headers |
|
|
|
|
|
|
|
option httpclose |
|
|
|
|
|
|
|
option forwardfor |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# HTTP: Redirect insecure requests to HTTPS |
|
|
|
# Bind URL with the right backend |
|
|
|
http-request redirect scheme https if !{ ssl_fc } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# HTTPS: Forward requests to the Libresonic backend |
|
|
|
|
|
|
|
acl is_libresonic path_beg -i /libresonic |
|
|
|
acl is_libresonic path_beg -i /libresonic |
|
|
|
use_backend libresonic-backend if is_libresonic |
|
|
|
use_backend libresonic-backend if is_libresonic |
|
|
|
|
|
|
|
|
|
|
|
backend libresonic-backend |
|
|
|
backend libresonic-backend |
|
|
|
|
|
|
|
|
|
|
|
# Make sure that we are in HTTP mode so that we can rewrite headers |
|
|
|
|
|
|
|
mode http |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Rewrite all redirects to use HTTPS, similar to what Nginx does in the |
|
|
|
# Rewrite all redirects to use HTTPS, similar to what Nginx does in the |
|
|
|
# proxy_redirect directive. |
|
|
|
# proxy_redirect directive. |
|
|
|
http-response replace-value Location ^http://(.*)$ https://\1 |
|
|
|
http-response replace-value Location ^http://(.*)$ https://\1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# (OPTIONAL) Force HTTPS |
|
|
|
|
|
|
|
redirect scheme https if !{ ssl_fc } |
|
|
|
|
|
|
|
|
|
|
|
# Forward requests to Libresonic running on localhost on port 4040 |
|
|
|
# Forward requests to Libresonic running on localhost on port 4040 |
|
|
|
server libresonic 127.0.0.1:4040 check |
|
|
|
server libresonic 127.0.0.1:4040 check |
|
|
|
``` |
|
|
|
``` |
|
|
|