2

I created an Angular 12 project with scully v2.1.32 and it was working on the server, using docker and nginx to serve. However, when performing a performance test, there was always routing (301) of the route, related to trailing slash. I followed the recommendations of:

https://www.c-sharpcorner.com/article/angular-7-routing-with-preserving-trailing-slash-in-url/

Therefore, I changed all routes in Angular to "xxxx/." and insert the Location.stripTrailingSlash function as indicated in the article above. The solution worked normally in tests on localhost, with the routes appearing in the browser ending with "/" (localhost:1668/xxxx/).

The problem occurs when running "RUN npm run scully" in docker: appears the message "Route '/passeios/seleciona_regiao/.' not provided by angular app", and then a fatal error in a postProcessByHtml plugin.

Can anyone give me a tip on how to solve the situation or point me to another solution regarding trailing slash (maybe any Angular configuration)?

Installation in docker is using node:14.19.1-alpine and running:

FROM node:14.19.1-alpine as builder
RUN apk add --no-cache
  chromium
  nss
  freetype
  freetype-dev
  harfbuzz
  ca-certificates
  ttf-freefont
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV SCULLY_PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium-browser

Thanks

RMartins
  • 29
  • 3
  • This really is a non issue. Your scully generated static files will work with a trailing slash. Only after angular kicks in in the browser, it will remove the slash again. Scully actually has a plugin build in to make sure the rendered hrefs in you static files have the traling slash in there (which will make google happy if that is your goal). I would revert the angular hack you have supplied as this will only break things. – MikeOne Jun 03 '22 at 19:20
  • Thank you,@MikeOne. You're right... I'm using seoHrefOptimise too, but reverting the angular hack, I would go back to the original situation, where Lighthouse keeps complaining about 301. Shouldn't I care about that? – RMartins Jun 03 '22 at 21:49

0 Answers0