# SPDX-License-Identifier: Apache-2.0 # Fallback config file in case fetch for the provided mirror node tag fails. # grpc, rest, rest-java, web3, graphql and rosetta containers. # The upstream directive allows the use of the keepalive (good for performance), # but the hostname must be resolvable when nginx starts. upstream grpc_host { server grpc:5600; keepalive 16; } upstream rest_host { server rest:5551; keepalive 16; } upstream rest_java_host { server rest-java:8084; keepalive 16; } upstream web3_host { server web3:8545; keepalive 16; } server { # graphql and rosetta are optional containers, disabled by default, so we cannot leverage the upstream directive. set $graphql_host graphql:8083; set $rosetta_host rosetta:5700; # common configurations listen 5551; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header "Connection" ""; resolver 127.0.0.11 valid=600s; # let docker resolve the host names http2 on; # enable gRPC # web3 host location /api/v1/contracts/call { proxy_pass http://web3_host$request_uri; } location ~ "^/api/v1/contracts/results/((0x)?[A-Fa-f0-9]{64}|\d+\.\d+\.\d+-\d+-\d+)/opcodes" { proxy_pass http://web3_host$request_uri; } # rest-java host location ~ "^/api/v1/accounts/(\d+\.){0,2}(\d+|(0x)?[A-Fa-f0-9]{40}|(?:[A-Z2-7]{8})*(?:[A-Z2-7]{2}|[A-Z2-7]{4,5}|[A-Z2-7]{7,8}))/(allowances/nfts|airdrops|hooks)" { proxy_pass http://rest_java_host$request_uri; } location ~ "^/api/v1/accounts/(\d+\.){0,2}(\d+|(0x)?[A-Fa-f0-9]{40}|(?:[A-Z2-7]{8})*(?:[A-Z2-7]{2}|[A-Z2-7]{4,5}|[A-Z2-7]{7,8}))/hooks/(0|[1-9]\d*)/storage$" { proxy_pass http://rest_java_host$request_uri; } location = /api/v1/network/exchangerate { proxy_pass http://rest_java_host$request_uri; } location = /api/v1/network/fees { proxy_pass http://rest_java_host$request_uri; } location = /api/v1/network/stake { proxy_pass http://rest_java_host$request_uri; } location = /api/v1/network/supply { proxy_pass http://rest_java_host$request_uri; } location ~ "^/api/v1/topics/(\d+\.){0,2}\d+$" { proxy_pass http://rest_java_host$request_uri; } # rest host location /api/v1/ { proxy_pass http://rest_host$request_uri; } # grpc host # Setting 600s read timeout for topic subscription. When the client receives a message the timeout resets to 0. location = /com.hedera.mirror.api.proto.ConsensusService/subscribeTopic { grpc_read_timeout 600s; grpc_pass grpc://grpc_host; } location /com.hedera.mirror.api.proto. { grpc_pass grpc://grpc_host; } location /grpc.reflection.v1alpha.ServerReflection { grpc_pass grpc://grpc_host; } # graphql host location = /graphql/alpha { proxy_pass http://$graphql_host$request_uri; } # rosetta host location /rosetta/ { rewrite ^/rosetta/(.*) /$1 break; proxy_pass http://$rosetta_host; } } # REST-Java direct passthrough on port 8084 server { listen 8084; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header "Connection" ""; location / { proxy_pass http://rest_java_host$request_uri; } }