设置生产URL Jhipster

时间:2016-09-02 14:19:37

标签: jhipster

当我打包生产,并且我想要恢复我的密码时,url导致我收到我的邮件是不正确的。

http://localhost:8095/af/#/reset/finish?key=03106204321257101265

正确的事情是

https://www.XXX.es/af/#/reset/finish?key=03106204321257101265

我没有在.yml中看到任何属性,也没有看到我需要的基础网址的步骤。

Jhipster 3.4.2

感谢您的帮助

2 个答案:

答案 0 :(得分:2)

server.port文件中设置server.addressapplication-prod.yml属性。有关详细信息和设置这些内容的其他方法,请参阅Spring Boot doc

答案 1 :(得分:-2)

似乎是动态形式,但是当它在服务器上时也会被视为“request.getServerName()”=“localhost”

不要使用内置的Jhipster Tomcat,而是使用其他外部。

 public ResponseEntity<?> requestPasswordReset(@RequestBody String mail, HttpServletRequest request) {
    System.out.println("scheme"+ request.getScheme());
    System.out.println("server name" + request.getServerName());
    System.out.println("server port" + request.getServerPort());
    System.out.println("context path"+ request.getContextPath());

    return userService.requestPasswordReset(mail)
        .map(user -> {
            String baseUrl = request.getScheme() +
                "://" +
                request.getServerName() +
                ":" +
                request.getServerPort() +
                request.getContextPath();
            mailService.sendPasswordResetMail(user, baseUrl);
            return new ResponseEntity<>("e-mail was sent", HttpStatus.OK);
        }).orElse(new ResponseEntity<>("e-mail address not registered", HttpStatus.BAD_REQUEST));
}