Dynamic routing in ASP .NET Core based on data received from frontend

I am working on CMS which contains many domains (so our URLs can look like www.example.com/group or www.example.com/de). I want to make a call from frontend based on current domain:

window.addEventListener('CookiebotOnAccept', (e) => {
    const domain = window.location.pathname.replace(/^/([^/]*).*$/, '$1');
    const URL = `${window.location.protocol}//${window.location.host}//${domain}/UpdateCookies`;
    console.log(domain)
    fetch(URL, {credentials: 'include'})
    .then((response) => {
        if (!response.ok) {
            throw new Error("Cookie consent update was not succesful")
        }
    })
    .catch((error) => {
        console.error('There has been a problem with your fetch operation: ', error)
    })
}, false)

…and then I need to be able to send it to a endpoint in the backend, which needs to have a dynamic routing based on domain it currently receives request from.
Backend endpoint:

[Route("CookieHandler")]
    public class CookieHandlerController : Controller
    {
        private readonly IHttpContextAccessor _httpContextAccessor;
        private readonly ICookieService _cookieService;

        public CookieHandlerController(IHttpContextAccessor httpContextAccessor, ICookieService cookieService)
        {
            _httpContextAccessor = httpContextAccessor;
            _cookieService = cookieService;
        }

        [HttpGet]
        [Route("UpdateCookies")]
        public IActionResult UpdateCookies()
        {
            var requestCookies = _httpContextAccessor.HttpContext?.Request.Cookies;

            foreach (var cookie in requestCookies)
            {
                    _cookieService.UpdateCookiesAccordingToConsent(cookie.Key);
            }

            return Ok();
        }
    }

So, basically the endpoint routing needs to look like this:

www.example.com/group/updatecookies

or

www.example.com/fr/updatecookies

The reason for such strange setup is because there are some Http-only cookies which have their specific path value based on their domain.