unit icon indicating copy to clipboard operation
unit copied to clipboard

URI rewrite

Open lcrilly opened this issue 3 years ago • 0 comments

The generic requirement is for Unit to accept requests for one URI, and process it as if it were for a different URI. This need often arises as web sites/apps evolve, and resources get reorganised. Clients may continue to make requests against URIs that no longer exist. Unit can preserve the original behaviour and optimize for end user experience by transparently rewriting the URI to one that exists in the new scheme.

Use case Request URI Rewrite URI
Application accepts requests at root level but shares a hostname with other apps (disambiguation) /calc/subtract /subtract
API endpoint got renamed /api/calc/v1/add /api/calc/v1/sum
Introduced 2-level nav structure for blog posts (now with topic) /blog/20220628/how-to-swim.html /blog/swimming/20220628/how-to-swim.html
Someone put upper case in an email newsletter /news/Summer-SALE.html /news/summer-sale.html
A function of one application is now implemented in its own application with a different input style /calc/trigonometry/tan/60 /trig/tangent?degrees=60

It is anticipated that the "routes" object will be extended to support this capability.

lcrilly avatar Jul 01 '22 15:07 lcrilly