forked from unchained-capital/caravan
-
Notifications
You must be signed in to change notification settings - Fork 2
/
bitcoind.proxy
85 lines (76 loc) · 3.35 KB
/
bitcoind.proxy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
upstream bitcoind {
# local server
server 127.0.0.1:8332;
# remote server
#server 192.168.0.22:8332
}
## mainnet configuration
server {
listen 8080;
server_name bitcoind.localhost;
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'POST, OPTIONS';
# Custom headers and headers various browsers *should* be OK with but aren't
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
# Tell client that this pre-flight info is valid for 20 days
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'POST') {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'POST, OPTIONS';
# Custom headers and headers various browsers *should* be OK with but aren't
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
}
proxy_pass http://bitcoind;
proxy_set_header Host $host;
proxy_set_header Accept-Encoding "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Referer $http_referer;
proxy_set_header X-Forwarded-For "$http_x_forwarded_for, $realip_remote_addr";
}
}
## testnet configuration
#upstream testnet {
# # local testnet
# server 127.0.0.1:18332;
# # remote testnet
# #server 192.168.0.22:18332
#}
#server {
# listen 8080;
# server_name testnet.localhost;
# location / {
# if ($request_method = 'OPTIONS') {
# add_header 'Access-Control-Allow-Origin' '*' always;
# add_header 'Access-Control-Allow-Methods' 'POST, OPTIONS';
# # Custom headers and headers various browsers *should* be OK with but aren't
# add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
# # Tell client that this pre-flight info is valid for 20 days
# add_header 'Access-Control-Max-Age' 1728000;
# add_header 'Content-Type' 'text/plain; charset=utf-8';
# add_header 'Content-Length' 0;
# return 204;
# }
# if ($request_method = 'POST') {
# add_header 'Access-Control-Allow-Origin' '*' always;
# add_header 'Access-Control-Allow-Methods' 'POST, OPTIONS';
# # Custom headers and headers various browsers *should* be OK with but aren't
# add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
# add_header 'Access-Control-Allow-Credentials' 'true';
# add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
# }
# proxy_pass http://testnet;
# proxy_set_header Host $host;
# proxy_set_header Accept-Encoding "";
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header Referer $http_referer;
# proxy_set_header X-Forwarded-For "$http_x_forwarded_for, $realip_remote_addr";
# }
#}