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 CONSUMER = "consumer";
    String APPLICATION_KEY = "application";
    String APPLICATION_VERSION_KEY = "application.version";
    String APPLICATION_PROTOCOL_KEY = "application-protocol";
    String METADATA_SERVICE_PORT_KEY = "metadata-service-port";
    String METADATA_SERVICE_PROTOCOL_KEY = "metadata-service-protocol";
    String METRICS_SERVICE_PORT_KEY = "metrics-service-port";
    String METRICS_SERVICE_PROTOCOL_KEY = "metrics-service-protocol";
    String LIVENESS_PROBE_KEY = "liveness-probe";
    String READINESS_PROBE_KEY = "readiness-probe";
    String STARTUP_PROBE = "startup-probe";
    String REMOTE_APPLICATION_KEY = "remote.application";
    String ENABLED_KEY = "enabled";
    String DISABLED_KEY = "disabled";
    String DUBBO_PROPERTIES_KEY = "dubbo.properties.file";
    String DEFAULT_DUBBO_PROPERTIES = "dubbo.properties";
    String DUBBO_MIGRATION_KEY = "dubbo.migration.file";
    String DUBBO_MIGRATION_FILE_ENABLE = "dubbo.migration-file.enable";
    String DEFAULT_DUBBO_MIGRATION_FILE = "dubbo-migration.yaml";
    String ANY_VALUE = "*";
    /**
     * @since 2.7.8
     */
    char COMMA_SEPARATOR_CHAR = ',';
    String COMMA_SEPARATOR = ",";
    String DOT_SEPARATOR = ".";
    Pattern COMMA_SPLIT_PATTERN = Pattern.compile("\\s*[,]+\\s*");
    String PATH_SEPARATOR = "/";
    String PROTOCOL_SEPARATOR = "://";
    String PROTOCOL_SEPARATOR_ENCODED = URL.encode(PROTOCOL_SEPARATOR);