From what you describe, it seems like you want to use a custom request handler to intercept calls to a published REST service. That’s not possible. Custom request handlers handle requests by returning a response. They don’t intercept and change requests for other handlers or published services.
Either your custom request handler can handle requests to /rest/, by reding the request and returning a response, or the published REST service handles the requests and returns a response.