API Subfolder/route on custom domain [SOLVED]

I have a custom domain using netlify and everything is working perfectly.

However I need a /api/ route on my domain which will point to another server. What is the best way to do this?

If it’s not possible would it be possible via subdomain e.g. api.customdomain.com?

Many thanks.

Hey @mabdu11ah,
You can do this with redirects: https://docs.netlify.com/routing/redirects/redirect-options/#splats

You’d have a rule like: customdomain.com/api/* otherserver.com/:splat 301!

If you host DNS with us, you could also go the subdomain route, yes.

Let us know if that helps or if you have other questions!