-
Notifications
You must be signed in to change notification settings - Fork 6
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
Redirect management overhaul #89
Comments
Possible feature: pass "aliases" to content in the front-matter yaml of each piece of content. When the content service loads it, it would see the aliases in the envelope data, and it could setup the redirects then... the only issue I see with this, is if we remove an alias from the front-matter yaml, how would the content service know to remove the redirect? Thoughts? |
I do like the idea of managing redirects there, but there are lots of other difficulties with the implementation:
Essentially, that would be a different, much harder thing to implement than what I'm talking about here. It might still be worth doing -- we'd talked about trying to infer redirects somehow, and I think this is more promising than that -- but it escalates the work required to the "months" range. We would also still need a way to configure redirects in the control repository, because otherwise we'd have no way to redirect off-cluster. So I'd rather improve the presenter config story first and get you something that helps you ship within a few weeks. |
Can you open an issue on deconst/deconst-docs for that? I can try to brainstorm how to best fit that in there. |
As for improvements on the redirect configuration format, some quick ideas:
|
👍 for multiple files. It doesn't add a significant amount of complexity, but makes it easier to logically separate sets of redirects that have different purposes. If we're going to set that precedent, we should also allow multiple files for route and content configuration, too. Something like this:
I believe "nesting" is already possible in a way, by setting I was going to weigh in on the JSON thing, but there's active discussion going on in Slack, so i'm gonna bite my tongue for a bit. |
👍 on multiple files. I believe this would make our strategy a little easier to manage, while preserving the fundamental way we're doing redirects now. |
@steveortiz: Any feedback on this? My thoughts right now:
|
dibs on |
👍 ✨ |
Sorry for dropping off the discussion... still heads down getting ready for our release tomorrow. But I did catch up on the previous conversation. To answer @kenperkins's question about whether the current setup is adequate. Well, the rewrites config file in nexus-control would become unwieldy, but... yes, it would work in a pinch, if you don't mind my adding 5,000 lines to it. Longer-term, splitting that out helps some, but it is still disconnected from the content and the authors do not have an easy way to add to it. Say for instance, that the product name changes, so all the articles with that in the product name need to change... ideally, you should also go back and update all other redirects that pointed to this article as well, so you don't end up with a long chain of redirects. What a mess! If instead, in the content file, you had a list of "aliases"... you'd just add one old name to the aliases and rename the file. The preparer would see the new alias and handle it (discussed below). This is a better experience from the content creator's perspective... and with as many articles as we have in the KC, adding redirects is a frequent occurrence. The problems @smashwilson mentioned. If the content is no longer in nexus... possible solution: rather you could add the keyword "redirect" to the front-matter... and the content store would not create an entry for content, but an entry for the redirect to whatever location was specified in the front-matter. If there is a conflict, both an alias and content with the same path, the content should win. You could implement this by checking for an alias or redirect only if the content is not found. The case where you have the same alias specified by two different pieces of content is trickier. I guess you could create and possibly replace the alias whenever the request comes in, but only remove the alias if it includes the expected location. I'm not saying the presenter shouldn't have the ability to redirect from the nexus-control. I think that is helpful. However, I think the authors should have easy access to redirects, so we should put something in the front-matter that gives them this capability. |
The idea of aliases in the content files is problematic, because the presenter fetches content files based on the URL currently being requested. So if a visitor requests I think this points towards the need for a single source of truth regarding redirects. While we have this in our current static files, maybe there's a need for a "Redirect service" of some sort that is pinged by the content service when it receives content containing redirects, and is consulted by the presenter when routing requests. |
I've been brainstorming ways we could make this work and I think it would be doable if we store redirect data as a separate map of URL patterns 👉 content ID rather than as actual metadata attached to each envelope. Then we can change the way requests are served to something like:
Rewrites are slightly more complicated but similar: I think we can just use the transformed presented URL, redo the content ID derivation from the content map, do both content lookups in parallel, and use the envelope from the transformed content ID if the original presented URL is unmapped or has no content. It is more traffic per request but I'm willing to bet we'd still be bound by Cloud Files throughput anyway.
Hah. @steveortiz actually originally suggested a dedicated service for redirects and I resisted the idea. Collapsing the mapping and template services into the presenter simplified everything so much, I've been avoiding introducing more services since then as a result. We'd also have to duplicate the API key validation logic, etc. Honestly I was just thinking of adding a new set of |
@ktbartholomew -- I didn't explain my idea well. What I am suggesting is that we create entries in cloud files for each piece of content AND each alias/redirect. For your example, where it was called a.html and then was changed to b.html with an alias of a.html. The only time it would get a body from the content service is when the presenter requests b.html. For requests to a.html... it would find a very short response saying redirect to b.html in the envelope. |
@smashwilson -- I like your ideas on how to store redirects... either in a separate service in the content store with a different endpoint (a much better idea than my hypothetical of tacking on __redirect). What do you think about which service should create them? |
Yeah, I try to avoid using magic names, because you know it's only a matter of time until someone tries to make an envelope that actually has a content ID ending in
The nice part about making it a first-class concept in the API is that you can manage them with any client that has a valid API key. In practice, I'd expect redirects created from page metadata (Jekyll frontmatter or Sphinx per-page metadata) to be submitted by the content preparer, and redirects created from nexus-control files to be submitted by the increasingly-inaccurately-named asset preparer. |
LOL! Sounds like a good plan to me. |
We're about to inherit some thousands of redirects, so the "giant hand-edited JSON file" approach to redirect configuration is quickly going to become untenable. Let's investigate some alternatives to make it a bit more manageable.
One thing to keep in mind: we already have an open issue to draft a new control repository layout (rackerlabs/nexus-control#271). It would be wise to design this in a way that's compatible with our thoughts there, so that we don't have to accept three kinds of redirect configuration!
/cc @j12y, @steveortiz
The text was updated successfully, but these errors were encountered: