Skip to content

Commit

Permalink
Add NOT_FOUND_MEANS_INDEX option.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgoclawski committed Jan 23, 2018
1 parent e2878f8 commit 5f35420
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Variable | Description | Default
--- | --- | ---
`GCS_BUCKET_URL` | Full URL to the bucket folder. `https://storage.googleapis.com/[GCS_BUCKET_URL]/index.html` | None - required!
`LISTEN_PORT` | Server listen port | 8080
`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

## Health-checking

Expand Down
1 change: 1 addition & 0 deletions nginx-gcs-proxy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ COPY nginx.conf.tmpl /etc/nginx/nginx.conf.tmpl

ENV GCS_BUCKET_URL " "
ENV LISTEN_PORT "8080"
ENV NOT_FOUND_MEANS_INDEX "false"

ENTRYPOINT ["dockerize", \
"-template", \
Expand Down
3 changes: 3 additions & 0 deletions nginx-gcs-proxy/nginx.conf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ http {
proxy_cache_valid 200 1d;
add_header X-Cache $upstream_cache_status;

{{ if eq .Env.NOT_FOUND_MEANS_INDEX "true" }}
error_page 404 =200 /index.html;
{{ end }}
proxy_pass http://google-cloud-storage/{{ .Env.GCS_BUCKET_URL }}$uri;
}
}
Expand Down

0 comments on commit 5f35420

Please sign in to comment.