Forward plumbeR request to other endpoint in mounted router

This is perhaps a stupid question, but I can't seem to figure it out.

The following piece of code creates a router that exposes additional endpoints (such as /process) from inside the API where the function is run:

#* @plumber
function(pr) {
  modulateapi <- plumber::plumb("/path/to/other/plumber.R")
  pr %>%
    pr_mount("/modulate/", modulateapi )

Now, what I would like to do is to call the endpoints in the mounted router from inside the API where the mount exists. So for example if the above code exists in a file called 'all.R', then that file should also contain a function/endpoint that forwards the request to one of the mounted endpoints such as /process (i.e. the complete path would be /modulate/process):

# Redirect to modulate
#* @get /modforward
function(req, res){
    # Forward the request here to /modulate/process

So the question is: what should the code look like in the body of '/modforward' so it simply forwards the request to /modulate/process ?

I tried setting status = 303 and update 'Location' in the header of the response (res) to point to /modforward which correctly forwards, but that does not contain the request. I have hit rock bottom in trying to figure it out, so hopefully someone knows if this is even possible.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.