How to get the origin of a route

(How) is it possible to get the origin host domain in a route?

In order to set up a secure Access-Control-Allow-Origin header, I need to know from which domain the route is accessed. (Similar to HTTP Origin header)

I was hoping to geht this from the $request object but kirby()->request()->domain() contains the url Kirby is hosted on instead of the url the request was made from.