Java Web 服务器 W/ Angular 控制面板 Web 界面

Java Webserver W/ Angular Control Panel Web Interface

我已经使用 spring 引导创建了一个应用程序,它使用 angular 作为前端,是一个带有加密凭据和点击验证的基本登录门户,我想做的是像什么时候有人访问它获取 angular 门户的服务器的 IP,当它是一个域名时,它实际上会拉出该网站。我想将其编程为在 java 或 angular 中发生,以从 java 请求资源。如何实现这一点?我知道如何让 java 处理 http 请求并实际将 html 发送到浏览器...我不知道如何在使用 angular 前端时做到这一点充当我的控制面板。

这是我的目标,用户在服务器 IP 中输入可以更改的“0.0.0.0”到我指定的端口,即 8080,它将他们带到我的登录页面,即 angular 前端。一旦他们通过身份验证,它就会进入仪表板控制面板以管理服务器、Ip 等。但是,如果用户输入“Example.com”,即使他们输入端口 8080,我也希望它拉起 Index.hmtl “Example.com” 的文件不是 Angular Cpanel。这将是一个包含许多页面等的实际网站。 Angular 部分实际上只是用于服务器管理更改文件、更新电子邮件等。不确定以前在 java 之类的人中是否做过这件事,我真的只需要让 java 应用程序做一件事,如果是 IP,如果是域名,则做另一件事。

22 年 3 月 24 日更新: 好的,经过进一步研究,我正在尝试实现类似 Webmin、Plesk、cPanel esk 类型的应用程序。用户可以使用我将要使用 Angular 结合 Spring 引导的控制面板制作他们的网站等。如果您输入 IP 和指定的端口,这些应用程序只会调出登录屏幕,否则它们将根据用户输入的内容加载所需的记录和站点,我不知道这是否需要 Angular 如果 URL 不满足登录屏幕出现的条件,或者如果这里需要不同的方法,则使用 URL 将字符串传递给后端.

好的,所以我发现我正在寻找的答案是通过代理,您可以从 . It seems that what I was looking for in this case is a proxy which is defined in Angular's Documentation here. Once you have these two put together, you can then pass the base URL or really the Entire URL Back to the Spring Boot backend to request the requested resource, however by using the proxy it seems this would not be needed and would just need the Backend to be able to handle requests as they are redirected to the Backend, which would then be passed back to the front end to put together for the client. building an httpserver is done by using this class 中的答案中获取域名,并且可以与其他一些结合起来实际返回请求到 angular 应用程序,然后返回给客户。