Skip to content

Commit

Permalink
fix(nginx): Disable absolute redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
yuaanlin committed Jul 26, 2023
1 parent 4cf64ca commit 5f96a7e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions internal/nodejs/templates/nginx-runtime.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ RUN echo "\
server { \
listen 8080; \
root /usr/share/nginx/html/static; \
absolute_redirect off; \
location / { \
{{ if .SPA }} try_files \$uri /index.html; \
{{ else }} try_files \$uri \$uri.html \$uri/index.html /404.html =404; \
Expand Down
4 changes: 2 additions & 2 deletions internal/static/static.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ RUN hugo --minify
FROM docker.io/library/nginx:alpine as runtime
WORKDIR /usr/share/nginx/html/static
COPY --from=builder /src/public .
RUN echo "server { listen 8080; root /usr/share/nginx/html/static; }"> /etc/nginx/conf.d/default.conf
RUN echo "server { listen 8080; root /usr/share/nginx/html/static; absolute_redirect off; }"> /etc/nginx/conf.d/default.conf
EXPOSE 8080`, nil
}

dockerfile := `FROM docker.io/library/nginx:alpine as runtime
WORKDIR /usr/share/nginx/html/static
COPY . .
RUN echo "server { listen 8080; root /usr/share/nginx/html/static; }"> /etc/nginx/conf.d/default.conf
RUN echo "server { listen 8080; root /usr/share/nginx/html/static; absolute_redirect off; }"> /etc/nginx/conf.d/default.conf
EXPOSE 8080`

return dockerfile, nil
Expand Down

0 comments on commit 5f96a7e

Please sign in to comment.