code: private String extractOriginOrReferer(HttpExchange pExchange) {
          Headers headers = pExchange.getRequestHeaders();
          String origin = headers.getFirst("Origin");
          if (origin == null) {
              origin = headers.getFirst("Referer");
          }
          return origin != null ? origin.replaceAll("[\\n\\r]*","") : null;
      }
docs: Used for checking origin or referer is an origin policy is enabled