OLD | NEW |
1 global | 1 global |
2 maxconn 4096 | 2 maxconn 4096 |
3 user haproxy | 3 user haproxy |
4 group haproxy | 4 group haproxy |
5 daemon | 5 daemon |
6 # Set the base path for the WebSocket TLS certificate. | 6 # Set the base path for the WebSocket TLS certificate. |
7 ca-base {{ssl_cert_path}} | 7 ca-base {{ssl_cert_path}} |
8 # Set the base path for the HTTPS TLS certificate. | 8 # Set the base path for the HTTPS TLS certificate. |
9 crt-base {{ssl_cert_path}} | 9 crt-base {{ssl_cert_path}} |
10 | 10 |
11 defaults | 11 defaults |
12 log global | 12 log global |
13 maxconn 4096 | 13 maxconn 4096 |
14 mode http | 14 mode http |
15 option http-server-close | 15 option http-server-close |
16 timeout connect 5s | 16 timeout connect 5s |
17 timeout client 30s | 17 timeout client 30s |
18 timeout server 30s | 18 timeout server 30s |
19 # Set a long timeout for WebSocket connections. | 19 # Set a long timeout for WebSocket connections. |
20 timeout tunnel 8h | 20 timeout tunnel 8h |
21 | 21 |
22 backend juju | 22 backend juju |
23 # The Juju WebSocket backend. | 23 # The Juju WebSocket backend. |
24 # Re-encrypt outgoing connections. | 24 # Re-encrypt outgoing connections. |
25 {{if legacy_juju}} | 25 # Replace "/ws/" with "/" in any request path. |
26 server ws1 {{api_address}} ssl ca-file {{api_pem}} verify required check
-ssl inter 500ms | 26 reqrep ^([^\ ]*)\ /ws/ \1\ / |
27 {{else}} | 27 server ws1 {{api_address}} ssl check-ssl inter 500ms |
28 # Replace "/ws/" with "/" in any request path. | |
29 reqrep ^([^\ ]*)\ /ws/ \1\ / | |
30 server ws1 {{api_address}} ssl check-ssl inter 500ms | |
31 {{endif}} | |
32 | 28 |
33 backend web | 29 backend web |
34 # Web traffic. | 30 # Web traffic. |
35 server web1 127.0.0.1:{{web_port}} check inter 500ms | 31 server web1 127.0.0.1:{{web_port}} check inter 500ms |
36 | 32 |
37 frontend public | 33 frontend public |
38 # Redirect all HTTP traffic to HTTPS. | 34 # Redirect all HTTP traffic to HTTPS. |
39 bind :80 | 35 bind :80 |
40 {{if secure}} | 36 {{if secure}} |
41 redirect scheme https if !{ ssl_fc } | 37 redirect scheme https if !{ ssl_fc } |
42 {{endif}} | 38 {{endif}} |
43 # Handle HTTPS. | 39 # Handle HTTPS. |
44 bind :443 ssl crt {{web_pem}} | 40 bind :443 ssl crt {{web_pem}} |
45 # Send WebSocket connections to the Juju backend. | 41 # Send WebSocket connections to the Juju backend. |
46 use_backend juju if { path /ws } | 42 use_backend juju if { path /ws } |
47 # Send everything else to the web server. | 43 # Send everything else to the web server. |
48 default_backend web | 44 default_backend web |
OLD | NEW |