cy.visit() returns 404, but why? The site is completely reachable and I don't see a 404. #22738
-
Hi all, I have a simple site running well on http://localhost:4200/. When cy.visit('/my-study') is called I returns me an 404 (see screenshot below). But there when I open the complete url in the browser it works and I don't see by using the devtools a reason or a request which One more thing which is very strange: Any idea why the ONLY the cypress testrunner gives me a 404? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I could fix it at the end. I changed the config of the nginx-server.
FROM node:16.15.1-alpine as node FROM nginx:alpine |
Beta Was this translation helpful? Give feedback.
I could fix it at the end.
I was running my Angular app within a container based on the image -> node:16.15.1-alpine
I changed the config of the nginx-server.
I added following line to my nginx.conf:
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri /index.html;
}
I overwrote the default-config with my new config within my Dockerfile:
FROM node:16.15.1-alpine as node
WORKDIR /app
COPY . .
RUN npm ci
RUN npm run build:cypress
FROM nginx:alpine
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=node /app/dist/. /usr/share/nginx/html