//获取是http 还是 https,如果有通过nginx就行转发,记得配置带上sceme信息 String scheme = request.getScheme(); System.out.println("scheme = " + scheme); //获取域名 String serverName = request.getServerName(); System.out.println("serverName = " + serverName); //组装成基础url String basePath = scheme + "://" + request.getServerName() + "/"; System.out.println("basePath = " + basePath);
效果 basePath = http://ssvass-uat.longfor.com/