We are working on a dubbo gateway and need to support mutual access between different network clusters. This should be a common scenario. This requires dubbo to do two things for us:

1. Dynamically modify the ip and change the access of the local cluster to remote. This extension can be done, although there are some bugs, https://dubbo.apache.org/zh/docs3-v2/java-sdk/advanced-features-and-usage/service/specify-ip/

2. Forward the dubbo request. When the gateway receives the access request from cluster A, it should forward it to cluster B (now it returns an exception).

  From the code execution process.
  current:
  gateway-dubbo-provider receives the request -> parses -> judges whether the request interface has a corresponding cache URL -> no -> throws IOException -> netty returns

  ```java
  void handleRequest(final ExchangeChannel channel, Request req) throws RemotingException {
          Response res = new Response(req.getId(), req.getVersion());
          if (req.isBroken()) {
              Object data = req.getData();
              String msg;
              if (data == null) {
                  msg = null;
              } else if (data instanceof Throwable) {
                  msg = StringUtils.toString((Throwable) data);
              } else {
                  msg = data.toString();
              }
              res.setErrorMessage("Fail to decode request due to: " + msg);
              res.setStatus(Response.BAD_REQUEST);

              channel.send(res);
              return;
          }
  }
  ```

  ​

  expect:
  gateway-dubbo-provider receives the request -> parses -> judges whether the request interface has a corresponding cache URL -> no -> obtains the exception handler through spi (the request can be forwarded here) -> netty returns

```java
  void handleRequest(final ExchangeChannel channel, Request req) throws RemotingException {
          Response res = new Response(req.getId(), req.getVersion());
          if (req.isBroken()) {
              Object data = req.getData();
           //expert begin
          List<ExceptionHandler> list = spiExtensions.listByType(ExceptionHandler); 
          list.forEach(handler.handle(path,version))
           //expert end
              String msg;
              if (data == null) {
                  msg = null;
              } else if (data instanceof Throwable) {
                  msg = StringUtils.toString((Throwable) data);
              } else {
                  msg = data.toString();
              }
              res.setErrorMessage("Fail to decode request due to: " + msg);
              res.setStatus(Response.BAD_REQUEST);

              channel.send(res);
              return;
          }
  }
```


Since dubbo.extension provides dynamic ip replacement, then we should consider whether the target ip can be accepted and processed. I think this exception handler is an extension function of the dubbo.extension package.
We can provide ExceptionHandler similar to springboot, which can be more flexible

String DUBBO_INTERNAL_APPLICATION = "DUBBO_INTERNAL_APPLICATION";
    String RETRY_TIMES_KEY = "retry-times";
    String RETRY_PERIOD_KEY = "retry-period";
    String SYNC_REPORT_KEY = "sync-report";
    String CYCLE_REPORT_KEY = "cycle-report";
    String WORKING_CLASSLOADER_KEY = "WORKING_CLASSLOADER";
    String STAGED_CLASSLOADER_KEY = "STAGED_CLASSLOADER";
    String PROVIDER_ASYNC_KEY = "PROVIDER_ASYNC";
    String REGISTER_IP_KEY = "register.ip";
    String CURRENT_CLUSTER_INVOKER_KEY = "currentClusterInvoker";
    String ENABLE_ROUTER_SNAPSHOT_PRINT_KEY = "ENABLE_ROUTER_SNAPSHOT_PRINT";
    String INJVM_COPY_UTIL_KEY = "injvm-copy-util";
    String INJVM_IGNORE_SAME_MODULE_KEY = "injvm.ignore.same-module";
    String SET_FUTURE_IN_SYNC_MODE = "future.sync.set";
    String CLEAR_FUTURE_AFTER_GET = "future.clear.once";
    String NATIVE_STUB = "nativestub";
    String METADATA = "metadata";
    String IGNORE_LISTEN_SHUTDOWN_HOOK = "dubbo.shutdownHook.listenIgnore";
    String OPTIMIZER_KEY = "optimizer";
    String PREFER_JSON_FRAMEWORK_NAME = "dubbo.json-framework.prefer";
    /**
     * @since 3.1.0
     */
    String MESH_ENABLE = "mesh-enable";
    /**
     * @since 3.1.0
     */
    Integer DEFAULT_MESH_PORT = 80;
    /**
     * @since 3.1.0