skybrud / Skybrud.Umbraco.Redirects

Redirects manager for Umbraco.
https://packages.limbo.works/skybrud.umbraco.redirects/
MIT License
36 stars 41 forks source link

Implementation for Content Delivery API #206

Open cf-marc opened 1 week ago

cf-marc commented 1 week ago

Which version of Skybrud Redirects are you using? (Please write the exact version, example: 4.0.8)

13.0.4

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

13.4.0

Question

Hello

I wanted to inquire if there has been an implementation of a solution for handling redirects in the Content Delivery API. Specifically, I'm looking for a feature where, when an "Original URL" is provided as the path in the API request, the response includes a Location header with the appropriate redirect URL.

Currently, my workaround is to handle this scenario by making the application call the CMS URL with the path that was tried for the Content Delivery API whenever a 404 error is received. While this approach works, it would be more efficient and streamlined to have the redirect handled directly by the Content Delivery API.

Thanks for any help.

abjerner commented 1 week ago

Hi @cf-marc

To my knowledge Umbraco doesn't support hooking into its content delivery API, so I don't think will be possible to add support for Skybrud Redirects that way. That would be the ideal way to handle this though, since you wouldn't have to make an additional request.

There is however also an issue with how Umbraco's content delivery API handles content and media separately, whereas Skybrud Redirects doesn't distinguish between the two as it will look at any 404 request and see whether a redirect exists.

I have had one or two requests for adding my own content delivery API for redirects, which would make sense adding to the package (or a separate package on top of Skybrud Redirects). Its just not something I've had the time to look into yet. There are also multiple ways to go about this - e.g. whether the endpoint should return all redirects, return all redirects for a given node, or return a redirect for an inbound URL.

cf-marc commented 4 days ago

Thank you @abjerner for your quick response. Maybe in the future Umbraco allows to hook into the Content Delivery API.