I'm not sure I understand how this is related to nginx
since that would be only acting as reverse-proxy and thus requires no changes to the Rserve configuration.
But .http.request
has to be simply a function defined as
.http.request <- function(url, query, body, headers, ...)
You can do whatever you want and then return the following (quoted from Rserve):
the result is expected to have one of the following forms:
a) character vector of length 1 => error (possibly from try),
will create 500 response
b) list(payload[, content-type[, headers[, status code]]])
payload: can be a character vector of length one or a
raw vector. if the character vector is named "file" then
the content of a file of that name is the payload
content-type: must be a character vector of length one
or NULL (if present, else default is "text/html")
headers: must be a character vector - the elements will
have CRLF appended and neither Content-type nor
Content-length may be used
status code: must be an integer if present (default is 200)
Only payload is mandatory, everything else is optional. It is a good idea to wrap your code in something like tryCatch({ ... }, error=function(e) e$message)
so you see the output in case of a failure.
Note that this is the same API as used by the built-in HTTP server in R.
PS: Please consider using the stats-rosuda-devel mailing list for Rserve-related questions.