Skip to content

fix(aio): update redirects to fix unwanted 404s #21712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

petebacondarwin
Copy link
Contributor

@petebacondarwin petebacondarwin commented Jan 22, 2018

Closes #21377

The new regex for the Service Worker - the aim of which is to force a trip to the server for URLs that should be redirected - can be viewed on Debuggex: https://www.debuggex.com/r/V3bYY6Ny8XVY46Z8

screen shot 2018-01-22 at 20 42 02

We should really implement some form of testing for these redirects on both firebase and the service worker.

@petebacondarwin petebacondarwin added action: review The PR is still awaiting reviews from at least one requested reviewer comp: aio labels Jan 22, 2018
@mary-poppins
Copy link

You can preview c7d400e at https://pr21712-c7d400e.ngbuilds.io/.

@petebacondarwin petebacondarwin added the target: patch This PR is targeted for the next patch release label Jan 22, 2018
@mary-poppins
Copy link

You can preview 44c1640 at https://pr21712-44c1640.ngbuilds.io/.

@mary-poppins
Copy link

You can preview f11ac8d at https://pr21712-f11ac8d.ngbuilds.io/.

Copy link
Contributor

@IgorMinar IgorMinar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good. 🤷‍♂️ I'm not 100% sure, but I don't think it's feasible to be certain :-)

@IgorMinar IgorMinar removed the action: review The PR is still awaiting reviews from at least one requested reviewer label Jan 22, 2018
by translating the common idioms in the TypeScript documentation examples
(and elsewhere on the web) to ES6/7 and ES5.

This was [removed in August 2017](https://github.com/angular/angular/pull/18694) but can still be
viewed in the [v2 documentation](https://v2.angular.io/docs/ts/latest/cookbook/ts-to-js.html).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

{"type": 301, "source": "/docs/*/latest/api/upgrade/:package/index/:api-*", "destination": "/api/upgrade/:package/:api"},
{"type": 301, "source": "/docs/*/latest/api", "destination": "/api"},
{"type": 301, "source": "/docs/*/latest/glossary", "destination": "/guide/glossary"},
{"type": 301, "source": "/docs/*/latest/guide/", "destination": "/guide"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this supposed to go. I don't think we have a /guide URL 😕

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will 404 at the moment - we should have a placeholder for that folder really.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not redirect to /docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it would motivate us to fix it

{"type": 301, "source": "/docs/*/latest/api/:package/testing", "destination": "/api/:package/testing"},
{"type": 301, "source": "/docs/*/latest/api/:package/testing/index/:api-*", "destination": "/api/:package/testing/:api"},
{"type": 301, "source": "/docs/*/latest/api/platform-browser/animations/index/:api-*", "destination": "/api/platform-browser/animations/:api"},
{"type": 301, "source": "/docs/*/latest/api/testing/:api-*", "destination": "/api/core/testing/:api"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT, URL matching this pattern will also match /docs/*/latest/api/:package/:api-*, which appears above and as result be redirected to /api/testing/:api instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think since it will then do another round of redirect it will end up at the correct place. E.g.

/docs/ts/latest/api/testing/fakeAsync-function.html =>
  /api/testing/fakeAsync =>
     /api/core/testing/fakeAsync

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know redirects are applied recursively 👍

{"type": 301, "source": "/guide/metadata", "destination": "/guide/aot-compiler"},
{"type": 301, "source": "/guide/ngmodule", "destination": "/guide/ngmodules"},
{"type": 301, "source": "/guide/learning-angular*", "destination": "/guide/quickstart"},
{"type": 301, "source": "/news*", "destination": "https://blog.angular.io/"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

@@ -19,7 +19,7 @@
"routing": {
"index": "/index.html",
"routes": {
"^(?!/docs/ts/latest|/guide/(?:cli-quickstart|metadata|ngmodule|service-worker-(?:getstart|comm|configref))/?$|/styleguide).*/(?!e?plnkr)[^/.]*$": {
"^(?!/docs/.|/guide/(?:cli-quickstart|metadata|ngmodule|service-worker-(?:getstart|comm|configref)|learning-angular)|/news/?$|/testing|/api/(?:common/NgModel|platform-browser/AnimationDriver|testing|api)).*/(?!e?plnkr|(?:NgFor|MaxLengthValidator)-|Control(?:Group)?|AnimationStateDeclarationMetadata|CORE_DIRECTIVES|PLATFORM_PIPES|DirectiveMetadata|HTTP_PROVIDERS)[^/.]*$": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RegExp will now also exclude /guide/service-worker-communication. The $ should be applied to all guide/* matches as well. E.g.:

-...|learning-angular)|/news/?$|...
+...|learning-angular|/news)/?$|...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@IgorMinar
Copy link
Contributor

in order to mitigate risk, let's get this into next first and test it there before pushing it to production

@IgorMinar IgorMinar added target: major This PR is targeted for the next major release action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed target: patch This PR is targeted for the next patch release labels Jan 22, 2018
@petebacondarwin petebacondarwin force-pushed the aio-redirects branch 2 times, most recently from b969f6f to cc06730 Compare January 23, 2018 14:57
@mary-poppins
Copy link

You can preview cc606c3 at https://pr21712-cc606c3.ngbuilds.io/.

@mary-poppins
Copy link

You can preview b969f6f at https://pr21712-b969f6f.ngbuilds.io/.

@mary-poppins
Copy link

You can preview cc06730 at https://pr21712-cc06730.ngbuilds.io/.

Copy link
Contributor

@IgorMinar IgorMinar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! since we don't have a good way to e2e test this, let's push it to next first and only later into prod via a separate PR.

@IgorMinar IgorMinar added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Jan 23, 2018
@IgorMinar IgorMinar dismissed gkalpak’s stale review January 23, 2018 16:23

issues have been fixed

@IgorMinar IgorMinar removed the action: merge The PR is ready for merge by the caretaker label Jan 23, 2018
mhevery added a commit that referenced this pull request Jan 24, 2018
mhevery added a commit that referenced this pull request Jan 24, 2018
mhevery added a commit that referenced this pull request Jan 24, 2018
@mhevery
Copy link
Contributor

mhevery commented Jan 24, 2018

This PR has been revert because it is failing https://travis-ci.org/angular/angular/jobs/332971529 Please open new PR after you fix this

petebacondarwin added a commit to petebacondarwin/angular that referenced this pull request Jan 25, 2018
petebacondarwin added a commit to petebacondarwin/angular that referenced this pull request Jan 25, 2018
petebacondarwin added a commit to petebacondarwin/angular that referenced this pull request Jan 25, 2018
petebacondarwin added a commit to petebacondarwin/angular that referenced this pull request Jan 25, 2018
petebacondarwin added a commit to petebacondarwin/angular that referenced this pull request Jan 25, 2018
petebacondarwin added a commit to petebacondarwin/angular that referenced this pull request Jan 25, 2018
jbogarthyde pushed a commit to jbogarthyde/angular that referenced this pull request Feb 23, 2018
jbogarthyde pushed a commit to jbogarthyde/angular that referenced this pull request Feb 23, 2018
jbogarthyde pushed a commit to jbogarthyde/angular that referenced this pull request Feb 23, 2018
jbogarthyde pushed a commit to jbogarthyde/angular that referenced this pull request Feb 23, 2018
jbogarthyde pushed a commit to jbogarthyde/angular that referenced this pull request Feb 23, 2018
jbogarthyde pushed a commit to jbogarthyde/angular that referenced this pull request Feb 23, 2018
jbogarthyde pushed a commit to jbogarthyde/angular that referenced this pull request Feb 23, 2018
jbogarthyde pushed a commit to jbogarthyde/angular that referenced this pull request Feb 23, 2018
leo6104 pushed a commit to leo6104/angular that referenced this pull request Mar 25, 2018
leo6104 pushed a commit to leo6104/angular that referenced this pull request Mar 25, 2018
leo6104 pushed a commit to leo6104/angular that referenced this pull request Mar 25, 2018
leo6104 pushed a commit to leo6104/angular that referenced this pull request Mar 25, 2018
leo6104 pushed a commit to leo6104/angular that referenced this pull request Mar 25, 2018
leo6104 pushed a commit to leo6104/angular that referenced this pull request Mar 25, 2018
leo6104 pushed a commit to leo6104/angular that referenced this pull request Mar 25, 2018
leo6104 pushed a commit to leo6104/angular that referenced this pull request Mar 25, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setup more redirects for old angular.io links
6 participants