code: @Override
      public void filter(ContainerRequestContext ctx) throws IOException {
  
          String scheme = getValue(ctx.getHeaders(), "x-forwarded-proto");
          String port = getValue(ctx.getHeaders(), "x-forwarded-port");
          if (scheme == null && port == null)
              return;
  
          UriBuilder baseBuilder = ctx.getUriInfo().getBaseUriBuilder();
          UriBuilder requestBuilder = ctx.getUriInfo().getRequestUriBuilder();
          if (scheme != null) {
              baseBuilder.scheme(scheme);
              requestBuilder.scheme(scheme);
              baseBuilder.port(443);
              requestBuilder.port(443);
          }
  
          if (port != null) {
              int nPort = Integer.parseInt(port);
              baseBuilder.port(nPort);
              requestBuilder.port(nPort);
          }
  
          ctx.setRequestUri(baseBuilder.build(), requestBuilder.build());
      }
docs: {@inheritDoc}