Skip to content

Instantly share code, notes, and snippets.

@alpha14
Last active May 2, 2022 18:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alpha14/9e6078979ae3b2df9201b49bbe7c9fc3 to your computer and use it in GitHub Desktop.
Save alpha14/9e6078979ae3b2df9201b49bbe7c9fc3 to your computer and use it in GitHub Desktop.
Server Side static redirects

Platform server side static redirects comparison

Feature Gitlab Cloudflare Netlify Example
Redirects ✔️ Yes
200, 301, 302
✔️ Yes
301, 302, 303, 307, 308
✔️ Yes /wardrobe.html /narnia.html 302
Rewrites ✔️ Yes ✔️ Yes ✔️ Yes /* / 200
Rewrites (other than 200) ❌ No ❌ No ✔️ Yes /en/* /en/404.html 404
Splats ✔️ Yes ✔️ Yes ✔️ Yes /news/* /blog/:splat
Placeholders ✔️ Yes ✔️ Yes ✔️ Yes /news/:year/:month/:date /blog-:year-:month-:date.html
Query parameters ❌ No ❌ No ✔️ Yes /store id=:id /blog/:id 301
Force (shadowing) ❌ No ✔️ Yes ✔️ Yes /app/ /app/index.html 200!
Proxying ❌ No ❌ No ✔️ Yes /blog/* https://blog.my.domain/:splat 200
Domain-level redirects ❌ No ❌ No ✔️ Yes http://blog.test.io/* https://test.io/blog/:splat 301
Redirect by country or language ❌ No ✔️ Yes ✔️ Yes / /anz 302 Country=au,nz
Redirect by role ❌ No ❌ No ✔️ Yes /admin/* 200! Role=admin
Limitations 1,000 1,000 static
100 dynamic
Unknown

Sources: https://docs.gitlab.com/ee/user/project/pages/redirects.html https://developers.cloudflare.com/pages/platform/redirects/ https://docs.netlify.com/routing/redirects/

Additionnal server side redirects: https://surge.sh/help/adding-redirects https://docs.aws.amazon.com/AmazonS3/latest/userguide/how-to-page-redirect.html https://docs.microsoft.com/en-us/azure/static-web-apps/configuration

Other links: https://nextjs.org/docs/api-reference/next.config.js/redirects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment