加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

JHipster非角度登陆页面

发布时间:2020-12-17 18:05:24 所属栏目:安全 来源:网络整理
导读:我想在JHipster项目中使用普通的html视图作为登陆页面. Spring-Boot控制器是否有最佳实践?我的目标是为路径“/”使用非角度html页面. angular-index.html由spring boot默认值自动加载.我不明白我如何使用弹簧靴的这种自动配置,同时对路径“/”有一个非角度
我想在JHipster项目中使用普通的html视图作为登陆页面. Spring-Boot控制器是否有最佳实践?我的目标是为路径“/”使用非角度html页面. angular-index.html由spring boot默认值自动加载.我不明白我如何使用弹簧靴的这种自动配置,同时对路径“/”有一个非角度的视图.

@RequestMapping("/")
public String hi() {
    return "hi";
}

这是呈现位于/ resources / templates中的“hi.html”视图的方法.视图显示正确但我无法再处理角度应用程序(例如/ home).

解决方法

JSHipster – 可以使用html5路由,这意味着你去Root JSHipset是在浏览器上使用路由.由此得出它使用了角度路由.

但是,当您使用部分路由’/ api / *’时,它会执行您的后端路由.您可以在application.yml中配置此路由.

enter image description here

问题是当你去rootPath jHipset转到index.html时它是Angular app.

我认为良好的做法是在服务器上设置重定向.

Jhipster可以使用NGINX.

你必须创建一个src / main / docker / nginx.yml Docker Compose文件:

version: '2'
services:
  nginx:
    image: nginx:1.13-alpine
    volumes:
    - ./../../../target/www:/usr/share/nginx/html
    - ./nginx/site.conf:/etc/nginx/conf.d/default.conf
    ports:
    - "8000:80"

添加./nginx/site.conf并配置:

server {
    listen 80;
    index index.html;
    server_name localhost;
    error_log  /var/log/nginx/error.log;

    location / {
        root /usr/share/nginx/html; //add path to another html file
    }
    location /api {
        proxy_pass http://api.jhipster.tech:8081/api;
    }
    location /front {
        proxy_pass http://api.jhipster.tech:8081/;
    }

    ...
}

规则位置/您可以更改为自定义URL(无角度视图).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读