Addressing comments

This commit is contained in:
muawiakh 2017-09-26 15:31:37 +02:00
parent 4371a2ce4b
commit dbddc7c85c
3 changed files with 14 additions and 11 deletions

View File

@ -1,5 +1,5 @@
#!/bin/bash
docker build -t bigchaindb/nginx_http:1.0 .
docker build -t bigchaindb/nginx_http:1.1 .
docker push bigchaindb/nginx_http:1.0
docker push bigchaindb/nginx_http:1.1

View File

@ -80,10 +80,6 @@ http {
# max client request body size: avg transaction size.
client_max_body_size 15k;
if ($request_method !~ ^(GET|OPTIONS|POST)$) {
return 444;
}
# No auth for GETs, forward directly to BDB.
if ($request_method = GET) {
proxy_pass http://$bdb_backend:BIGCHAINDB_API_PORT;
@ -91,6 +87,7 @@ http {
# POST requests get forwarded to OpenResty instance. Enable CORS too.
if ($request_method = POST ) {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
@ -108,6 +105,11 @@ http {
add_header 'Content-Length' 0;
return 204;
}
# Only return this reponse if request_method is neither POST|GET|OPTIONS
if ($request_method !~ ^(GET|OPTIONS|POST)$) {
return 444;
}
}
}

View File

@ -97,10 +97,6 @@ http {
# max client request body size: avg transaction size.
client_max_body_size 15k;
if ($request_method !~ ^(GET|OPTIONS|POST)$) {
return 444;
}
# No auth for GETs, forward directly to BDB.
if ($request_method = GET) {
proxy_pass http://$bdb_backend:BIGCHAINDB_API_PORT;
@ -126,6 +122,11 @@ http {
add_header 'Content-Length' 0;
return 204;
}
# Only return this reponse if request_method is neither POST|GET|OPTIONS
if ($request_method !~ ^(GET|OPTIONS|POST)$) {
return 444;
}
}
}
@ -147,7 +148,7 @@ http {
location / {
add_header Upgrade "TLS/1.2, HTTP/1.1" always;
default_type text/plain;
return 301 'Consider using the HTTPS protocol next time!';
return 426 'Consider using the HTTPS protocol next time!';
}
}
}