I am having an issue making hard refresh work on my dockerized angular app
I am using caddy
With this setup, im getting "This localhost page can’t be foundNo webpage was found for the web address: https://localhost/
HTTP ERROR 404"
However if i remove the handle part and replace it with "reverse_proxy angular:80", it works fine but the issue remains on hard refresh
Angular docker file:
# Use the official Node.js image to build the Angular app
FROM node:18-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY . .
RUN npm run build --prod
# Use a lightweight web server to serve the Angular app
FROM nginx:alpine
# Copy the Angular app build output to the Nginx html directory
COPY --from=build /app/dist/app /usr/share/nginx/html
# Expose the port that the container will run on
EXPOSE 80
Caddy File:
{
email [email protected]
}
https://localhost, https://domain.com {
reverse_proxy /api/* api:5000
# Handle requests for the Angular app
handle {
# Serve static files from Angular build directory
root * /usr/share/nginx/html
file_server
# Handle routing for SPA
try_files {path} /index.html
}
}