docs.nestjs.com icon indicating copy to clipboard operation
docs.nestjs.com copied to clipboard

Legacy docs can't be opened directly

Open leandro-manifesto opened this issue 3 years ago • 4 comments

I'm submitting a...


[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request (new chapter/page)
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

Acessing any legacy docs path other than root redirects to the current stable version.

https://docs.nestjs.com/v6/ works as expected, but https://docs.nestjs.com/v6/fundamentals/testing redirects to https://docs.nestjs.com.

Expected behavior

All paths should work properly.

Minimal reproduction of the problem with instructions

  1. Access https://docs.nestjs.com/v6/fundamentals/testing
  2. It gets redirected to https://docs.nestjs.com

leandro-manifesto avatar Mar 02 '21 22:03 leandro-manifesto

Would you like to create a PR for this issue?

kamilmysliwiec avatar Mar 03 '21 08:03 kamilmysliwiec

I'm not sure how the repository works to do that though.

I can see the legacy versions are in dist/, but nowhere else on the code. Are they compiled one last time and added there once the major version changes?

leandro-manifesto avatar Mar 04 '21 20:03 leandro-manifesto

I was able to reproduce this issue locally.

It looks like the routing is happening in app-routing.module.ts. All the routes seem to point to the docs pages, so access to the old versions would fall under the wildcard route at the bottom. The relative URL of '' used in the redirect seems to try to load any static files at that location.

v6/ works since that's an actual relative path, and index.html is loaded automatically. However, for https://docs.nestjs.com/v6/fundamentals/testing, it would look for the path /v6/fundamental/testing and that doesn't exist. That URL should be handled by the v6 app, which is at /v6/index.html.

I validated this theory by going to http://localhost:3000/v6/assets and it loads a view of the assets files.


I played with adding another route that matches the versioned URLs using UrlMatcher (tutorial on custom routes), but I'm not sure how to delegate to the old version's router without changing the URL directly to the old version (e.g. /v6/), losing the sub-path in the process.

This regex matches the versioned URLs: /^\/v\d\//

glenwinters avatar Oct 08 '21 05:10 glenwinters

FYI, as a way to get around this, I used Wayback machine to open older snapshots from the website, along with the npm package version history to figure out when each version was released. It doesn't always work (some snapshots are broken). but here're the working versions I found:

I couldn't find a working version for v7, unfortunately, do let me know if you find other alternatives. and I hope others find this helpful :)

amrawadk avatar Oct 11 '23 08:10 amrawadk