Skip to content

Commit e72cb0e

Browse files
authored
Merge pull request #16 from flownative/custom-resolver
BEACH_ASSET_PROXY_RESOLVER
2 parents a87b73f + f31fda4 commit e72cb0e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ for possible values. The default value is `warn`.
7070
| BEACH_NGINX_CUSTOM_METRICS_TARGET_PORT | integer | 8082 | Port at which Nginx should listen to provide the metrics for scraping |
7171
| BEACH_NGINX_MODE | string | Flow | Either "Flow" or "Static"; this variable is going to be renamed in the future |
7272
| BEACH_ASSET_PROXY_ENDPOINT | string | | Endpoint of a cloud storage frontend to use for proxying requests to Flow persistent resources. Requires BEACH_PERSISTENT_RESOURCES_BASE_PATH to be set. Example: "https://assets.flownative.com/example-bucket/" |
73+
| BEACH_ASSET_PROXY_RESOLVER | string | 8.8.8.8 | IP address of a DNS server to use for resolving domains when proxying assets. Set this to 127.0.0.11 when using Local Beach. |
7374
| BEACH_PERSISTENT_RESOURCES_BASE_PATH | string | | Base path of URLs pointing to Flow persistent resources; example: "https://www.flownative.com/assets/" |
7475
| BEACH_STATIC_RESOURCES_LIFETIME | string | 30d | Expiration time for static resources; examples: "3600s" or "7d" or "max" |
7576
| FLOW_HTTP_TRUSTED_PROXIES | string | 10.0.0.0/8 | Nginx passes FLOW_HTTP_TRUSTED_PROXIES to the virtual host using the value of this variable |

root-files/opt/flownative/lib/nginx-legacy.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ fi
4747
export BEACH_PERSISTENT_RESOURCES_FALLBACK_BASE_URI=${BEACH_PERSISTENT_RESOURCES_FALLBACK_BASE_URI:-}
4848
export BEACH_PERSISTENT_RESOURCES_BASE_PATH=${BEACH_PERSISTENT_RESOURCES_BASE_PATH:-/_Resources/Persistent/}
4949
export BEACH_ASSET_PROXY_ENDPOINT=${BEACH_ASSET_PROXY_ENDPOINT:-}
50+
export BEACH_ASSET_PROXY_RESOLVER=${BEACH_ASSET_PROXY_RESOLVER:-8.8.8.8}
5051
export BEACH_PHP_FPM_HOST=${BEACH_PHP_FPM_HOST:-localhost}
5152
export BEACH_PHP_FPM_PORT=${BEACH_PHP_FPM_PORT:-9000}
5253
export BEACH_NGINX_MODE=${BEACH_NGINX_MODE:-Flow}
@@ -190,7 +191,7 @@ EOM
190191
}
191192
# pass persistent resource requests to the custom endpoint (S3, Minio, GCS ...)
192193
location ~* "^${BEACH_PERSISTENT_RESOURCES_BASE_PATH}([a-f0-9]{40})/" {
193-
resolver 8.8.8.8;
194+
resolver ${BEACH_ASSET_PROXY_RESOLVER};
194195
proxy_set_header Authorization "";
195196
add_header Via 'Beach Asset Proxy';
196197
${addHeaderStrictTransportSecurity}
@@ -207,7 +208,7 @@ EOM
207208
}
208209
# pass persistent resource requests to GCS
209210
location ~* "^${BEACH_PERSISTENT_RESOURCES_BASE_PATH}([a-f0-9]{40})/" {
210-
resolver 8.8.8.8;
211+
resolver ${BEACH_ASSET_PROXY_RESOLVER};
211212
proxy_set_header Authorization "";
212213
add_header Via 'Beach Asset Proxy';
213214
${addHeaderStrictTransportSecurity}
@@ -229,7 +230,7 @@ EOM
229230
set \$assetUri ${BEACH_PERSISTENT_RESOURCES_FALLBACK_BASE_URI}\$1;
230231
add_header Via 'Beach Asset Fallback';
231232
${addHeaderStrictTransportSecurity}
232-
resolver 8.8.8.8;
233+
resolver ${BEACH_ASSET_PROXY_RESOLVER};
233234
proxy_pass \$assetUri;
234235
}
235236
EOM

0 commit comments

Comments
 (0)