Skip to content

Commit 5f35420

Browse files
committed
Add NOT_FOUND_MEANS_INDEX option.
1 parent e2878f8 commit 5f35420

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Variable | Description | Default
1919
--- | --- | ---
2020
`GCS_BUCKET_URL` | Full URL to the bucket folder. `https://storage.googleapis.com/[GCS_BUCKET_URL]/index.html` | None - required!
2121
`LISTEN_PORT` | Server listen port | 8080
22+
`NOT_FOUND_MEANS_INDEX` | When requested path is not found in the bucket, return index.html. Useful when serving single page apps, like Angular, React, Ember. Possible values: "true", "false". | false
2223

2324
## Health-checking
2425

nginx-gcs-proxy/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ COPY nginx.conf.tmpl /etc/nginx/nginx.conf.tmpl
1111

1212
ENV GCS_BUCKET_URL " "
1313
ENV LISTEN_PORT "8080"
14+
ENV NOT_FOUND_MEANS_INDEX "false"
1415

1516
ENTRYPOINT ["dockerize", \
1617
"-template", \

nginx-gcs-proxy/nginx.conf.tmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ http {
9090
proxy_cache_valid 200 1d;
9191
add_header X-Cache $upstream_cache_status;
9292

93+
{{ if eq .Env.NOT_FOUND_MEANS_INDEX "true" }}
94+
error_page 404 =200 /index.html;
95+
{{ end }}
9396
proxy_pass http://google-cloud-storage/{{ .Env.GCS_BUCKET_URL }}$uri;
9497
}
9598
}

0 commit comments

Comments
 (0)