and continue to bump up version numbers
[OpenSRF.git] / examples / nginx / osrf-ws-http-proxy
1 # File /etc/nginx/sites-available/osrf-ws-http-proxy
2 #
3 # $ ln -s /etc/nginx/sites-available/osrf-ws-http-proxy \
4 #   /etc/nginx/sites-enabled/osrf-ws-http-proxy
5 # $ sudo service nginx restart
6 #
7 # Assumes Apache is listening on HTTP=7080 and HTTPS=7443
8
9 server { 
10     listen 80;
11
12     location / {
13         proxy_pass http://localhost:7080;
14         proxy_set_header Host $host;
15         proxy_set_header X-Real-IP $remote_addr;
16         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
17         proxy_set_header X-Forwarded-Proto $scheme;
18     }
19 }
20
21 server {
22     listen 443;
23     ssl on;
24
25     # Use the same SSL certificate as Apache.
26     ssl_certificate /etc/apache2/ssl/server.crt;
27     ssl_certificate_key /etc/apache2/ssl/server.key;
28
29     location / {
30         proxy_pass https://localhost:7443;
31         proxy_set_header Host $host;
32         proxy_set_header X-Real-IP $remote_addr;
33         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
34         proxy_set_header X-Forwarded-Proto $scheme;
35     }
36
37     location /osrf-websocket-translator {
38         proxy_pass https://localhost:7682;
39         proxy_set_header X-Real-IP $remote_addr;
40         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
41
42         # Needed for websockets proxying.
43         proxy_http_version 1.1;
44         proxy_set_header Upgrade $http_upgrade;
45         proxy_set_header Connection "upgrade";
46
47         # Raise the default nginx proxy timeout values to an arbitrarily
48         # high value so that we can leverage osrf-websocket-translator's 
49         # timeout settings.
50         proxy_connect_timeout 5m;
51         proxy_send_timeout 1h;
52         proxy_read_timeout 1h;
53     }
54 }
55
56