-
Notifications
You must be signed in to change notification settings - Fork 26.2k
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
Conversation
44c1640
to
f11ac8d
Compare
You can preview c7d400e at https://pr21712-c7d400e.ngbuilds.io/. |
You can preview 44c1640 at https://pr21712-44c1640.ngbuilds.io/. |
You can preview f11ac8d at https://pr21712-f11ac8d.ngbuilds.io/. |
There was a problem hiding this 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 :-)
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). |
There was a problem hiding this comment.
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"}, |
There was a problem hiding this comment.
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 😕
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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"}, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 👍
aio/firebase.json
Outdated
{"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/"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate entry; a68a9d7#diff-45a3893504fac74c45720da147e7c77fR34
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
aio/ngsw-manifest.json
Outdated
@@ -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)[^/.]*$": { |
There was a problem hiding this comment.
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)/?$|...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
in order to mitigate risk, let's get this into |
b969f6f
to
cc06730
Compare
You can preview cc606c3 at https://pr21712-cc606c3.ngbuilds.io/. |
You can preview b969f6f at https://pr21712-b969f6f.ngbuilds.io/. |
You can preview cc06730 at https://pr21712-cc06730.ngbuilds.io/. |
There was a problem hiding this 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.
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 |
This reverts commit f11b2fb.
This reverts commit 01cef01.
…angular#21712)" This reverts commit 43d1b98.
This reverts commit f9a6a94.
This reverts commit f11b2fb.
This reverts commit 01cef01.
…angular#21712)" This reverts commit 43d1b98.
This reverts commit f9a6a94.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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
We should really implement some form of testing for these redirects on both firebase and the service worker.