Home
Support Forums

Content Negotiation Redirect by Format?

Is there a way to redirect or proxy based on the Accept header? See an example of what this might look like here, along with a use case:

https://citation.crosscite.org/docs.html

Ideally there is a way to set up a redirect to fire both based on the presence of the requested format, and the presence of the file in the requested format.

I’m not sure what Netlify uses on the back end, but here is how Apache accomplishes this:

https://httpd.apache.org/docs/2.4/content-negotiation.html

It seems possible also that this might have been solved already with a Netlify edge function.

At the moment, no. You’d have to rely on Netlify Functions. Depending on your use case, this might or might not be possible. If you can share more details about it, we’d be able to advise better.

I’m not implementing this yet, but looking into what is possible. It does look this might be possible to set up with netlify edge functions and Middy, using this package: