Enhance nginx config (#8179)

* Nginx config for frontend and backend in docker-compose

* Adding external frontend compatibility

* Adding l2 routes to nginx

* Fixing stats and account not working in docker-compose

* Fixing frontend custom url in docker-compose

* Fixing ws and stats v2

* Fixing frontend address in docker-compose

* Add CHANGELOG

---------

Co-authored-by: Viktor Baranov <baranov.viktor.27@gmail.com>
pull/8187/head
Nick Zenchik 1 year ago committed by GitHub
parent 205475c36d
commit e3205029c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 4
      docker-compose/envs/common-frontend.env
  3. 81
      docker-compose/proxy/default.conf.template
  4. 3
      docker-compose/services/docker-compose-nginx.yml

@ -25,6 +25,7 @@
- [#8183](https://github.com/blockscout/blockscout/pull/8183) - Update frontend envs in order to pass their validation
- [#8167](https://github.com/blockscout/blockscout/pull/8167) - Manage concurrency for Token and TokenBalance fetcher
- [#8179](https://github.com/blockscout/blockscout/pull/8179) - Enhance nginx config
- [#8146](https://github.com/blockscout/blockscout/pull/8146) - Add method_id to write methods in API v2 response
- [#8105](https://github.com/blockscout/blockscout/pull/8105) - Extend API v1 with endpoints used by new UI
- [#8104](https://github.com/blockscout/blockscout/pull/8104) - remove "TODO" from API v2 response

@ -1,7 +1,6 @@
NEXT_PUBLIC_API_HOST=localhost
NEXT_PUBLIC_API_PORT=81
NEXT_PUBLIC_API_PROTOCOL=http
NEXT_PUBLIC_STATS_API_HOST=http://localhost:82
NEXT_PUBLIC_STATS_API_HOST=http://localhost:8080
NEXT_PUBLIC_NETWORK_NAME=Göerli
NEXT_PUBLIC_NETWORK_SHORT_NAME=Göerli
NEXT_PUBLIC_NETWORK_ID=5
@ -11,6 +10,7 @@ NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS=18
NEXT_PUBLIC_API_BASE_PATH=/
NEXT_PUBLIC_FEATURED_NETWORKS=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/featured-networks/eth-goerli.json
NEXT_PUBLIC_APP_HOST=localhost
NEXT_PUBLIC_APP_PROTOCOL=http
NEXT_PUBLIC_HOMEPAGE_CHARTS="['daily_txs']"
NEXT_PUBLIC_VISUALIZE_API_HOST=http://visualizer:80
NEXT_PUBLIC_IS_TESTNET='true'

@ -1,54 +1,50 @@
server {
listen 80;
server_name localhost;
proxy_http_version 1.1;
location / {
proxy_pass ${FRONT_PROXY_PASS};
}
location /socket/v2 {
proxy_pass http://backend:4000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}
location /api/ {
proxy_pass http://backend:4000/api;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 81;
listen 80;
server_name localhost;
proxy_http_version 1.1;
proxy_hide_header Access-Control-Allow-Origin;
proxy_hide_header Access-Control-Allow-Methods;
add_header 'Access-Control-Allow-Origin' 'http://localhost' always;
add_header 'Access-Control-Allow-Methods' 'PUT, GET, POST, OPTIONS, DELETE, PATCH' always;
location / {
proxy_pass http://backend:4000;
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 Upgrade "$http_upgrade";
proxy_set_header Connection $connection_upgrade;
proxy_cache_bypass $http_upgrade;
}
location /auth {
proxy_pass http://backend:4000;
location = / {
proxy_pass ${FRONT_PROXY_PASS};
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
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 Upgrade "$http_upgrade";
proxy_set_header Connection $connection_upgrade;
proxy_cache_bypass $http_upgrade;
}
location /socket {
proxy_pass http://backend:4000;
location ~ ^/(_next|node-api|apps|account|accounts|static|auth/profile|auth/unverified-email|txs|tx|blocks|block|login|address|stats|search-results|token|tokens|visualize|api-docs|csv-export|verified-contracts|graphiql|withdrawals) {
proxy_pass ${FRONT_PROXY_PASS};
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
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 Upgrade "$http_upgrade";
proxy_set_header Connection $connection_upgrade;
proxy_cache_bypass $http_upgrade;
}
}
server {
listen 82;
listen 8080;
server_name localhost;
proxy_http_version 1.1;
proxy_hide_header Access-Control-Allow-Origin;
@ -59,12 +55,13 @@ server {
location / {
proxy_pass http://stats:8050;
}
location /socket/v2 {
proxy_pass http://backend:4000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
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 Upgrade "$http_upgrade";
proxy_set_header Connection $connection_upgrade;
proxy_cache_bypass $http_upgrade;
}
}

@ -12,5 +12,4 @@ services:
FRONT_PROXY_PASS: ${FRONT_PROXY_PASS:-http://frontend:3000}
ports:
- 80:80
- 81:81
- 82:82
- 8080:8080

Loading…
Cancel
Save