spa-to-http icon indicating copy to clipboard operation
spa-to-http copied to clipboard

Bug: Vue or React routers are broken on direct entry pathing

Open cghiurea opened this issue 1 year ago • 4 comments

Version: 1.0.7

Create a react or vue spa with a router. If you navigate to the router it will return a 404 with your new change of "prevent path traversal outside content directory"

Context our setup on our dev server is Apache reverse proxy to Spa-to-http to React Spa. The second setup is Traefik to Spa-to-HTTP to Vue Spa.

It returns a 404 .

image

cghiurea avatar Jun 28 '24 21:06 cghiurea

Yep, on 1.0.6 version it is working, just tested.

Satont avatar Jun 30 '24 05:06 Satont

@Satont yes, I forgot to mention version 1.0.6 it works. I had to revert to that version on our production servers.

cghiurea avatar Jun 30 '24 06:06 cghiurea

@Satont yes, I forgot to mention version 1.0.6 it works. I had to revert to that version on our production servers.

I think this might be due to fixing this issue #14 .

sunaley avatar Aug 22 '24 03:08 sunaley

It is 100% because it tries to reroute and does not work.

cghiurea avatar Aug 22 '24 03:08 cghiurea

This was fixed in 1.0.8 8 month ago.

Just retested:

npm create vue@latest
// set yes in: ✔ Add Vue Router for Single Page Application development? … No / Yes

cd vue-project
npm install

cat <<EOF > Dockerfile
FROM node:20-alpine as builder
WORKDIR /code/
ADD package-lock.json .
ADD package.json .
RUN npm ci
ADD . .
RUN npm run build

FROM devforth/spa-to-http:latest
COPY --from=builder /code/dist/ .
EOF

docker build -q . | xargs docker run --rm -p 8080:8080

Got to http://localhost:8080/about and F5

ivictbor avatar Feb 12 '25 11:02 ivictbor