As @Saqqara pointed out, CFD is your best choice if this needs to be fully automated.
Depending on what you are trying to do however, there could be a workaround using a dummy extension manipulating its forwarding rules.
Can you please describe in more details what you are trying to accomplish?