First attempt at replacing serve-4bytes with a nginx docker container drop-in
This commit is contained in:
parent
3a2f55905a
commit
850bf08833
|
@ -0,0 +1,3 @@
|
|||
FROM nginx:1.21.1-alpine
|
||||
COPY 4bytes/signatures /usr/share/nginx/html/
|
||||
COPY nginx-4bytes.conf /etc/nginx/conf.d/default.conf
|
|
@ -0,0 +1,50 @@
|
|||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
#access_log /var/log/nginx/host.access.log main;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
|
||||
# Base on: https://michielkalkman.com/snippets/nginx-cors-open-configuration/
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
#
|
||||
# Om nom nom cookies
|
||||
#
|
||||
add_header 'Access-Control-Allow-Credentials' 'true';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
|
||||
|
||||
#
|
||||
# Custom headers and headers various browsers *should* be OK with but aren't
|
||||
#
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
|
||||
|
||||
#
|
||||
# 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 = 'GET') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Credentials' 'true';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
|
||||
}
|
||||
}
|
||||
|
||||
#error_page 404 /404.html;
|
||||
|
||||
# redirect server error pages to the static page /50x.html
|
||||
#
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
}
|
|
@ -42,9 +42,11 @@
|
|||
"build": "craco build",
|
||||
"test": "craco test",
|
||||
"eject": "react-scripts eject",
|
||||
"serve-4bytes": "serve -p 3001 -C -c serve-4bytes.json",
|
||||
"start-4bytes": "docker run --rm -p 3001:80 --name otterscan-4bytes -d otterscan/4bytes",
|
||||
"stop-4bytes": "docker stop otterscan-4bytes",
|
||||
"serve-trustwallet-assets": "serve -p 3002 -C -c serve-trustwallet-assets.json",
|
||||
"serve": "serve -s build"
|
||||
"serve": "serve -s build",
|
||||
"build-docker-4bytes": "docker build -t otterscan/4bytes -f Dockerfile-4bytes ."
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
|
|
Loading…
Reference in New Issue