diff --git a/CHANGELOG.md b/CHANGELOG.md index 30736195..15b5479d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org). -## [Unreleased] +## 2.1.1 - 2019-09-22 #### Added @@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), * [#151](https://github.com/shlinkio/shlink-web-client/issues/151) Fixed "order by" indicator (caret) still indicate ASC on column header when no order is specified. * [#157](https://github.com/shlinkio/shlink-web-client/issues/157) Fixed pagination control on graphs expanding too much when lots of pages need to be rendered. +* [#155](https://github.com/shlinkio/shlink-web-client/issues/155) Fixed client-side paths resolve to 404 when served from nginx in docker image instead of falling back to `index.html`. ## 2.1.0 - 2019-05-19 diff --git a/Dockerfile b/Dockerfile index 1e28624c..4da33d8d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,5 +4,6 @@ RUN cd /shlink-web-client && npm install && npm run build FROM nginx:1.17.3-alpine LABEL maintainer="Alejandro Celaya " -RUN rm -r /usr/share/nginx/html +RUN rm -r /usr/share/nginx/html && rm /etc/nginx/conf.d/default.conf +COPY config/docker/nginx.conf /etc/nginx/conf.d/default.conf COPY --from=node /shlink-web-client/build /usr/share/nginx/html diff --git a/config/docker/nginx.conf b/config/docker/nginx.conf new file mode 100644 index 00000000..f9b2b816 --- /dev/null +++ b/config/docker/nginx.conf @@ -0,0 +1,17 @@ +server { + listen 80 default_server; + charset utf-8; + root /usr/share/nginx/html; + index index.html; + + # When requesting static paths with extension, try them, and return a 404 if not found + location ~ .+\.(css|js|html|png|jpg|jpeg|gif|bmp|ico|csv|otf|eot|svg|svgz|ttf|woff|woff2|ijmap|pdf|tif|map) { + try_files $uri $uri/ =404; + } + + # When requesting a path without extension, try it, and return the index if not found + # This allows HTML5 history paths to be handled by the client application + location / { + try_files $uri $uri/ /index.html$is_args$args; + } +}