Желаемая функциональность:
Код: Выделить всё
When accessing the server via its IP address (e.g., 0.0.0.0:8080): Users should be directed to the Angular login page. Once authenticated, they would have access to a control panel for managing server settings (IPs, files, etc.).
When accessing the server via a domain name (e.g., example.com:8080): The server should serve a different website (an index.html or multi-page site) rather than the Angular control panel.
Код: Выделить всё
I know how to handle HTTP requests in Java with Spring Boot and how to serve the Angular frontend as a static resource. However, I’m unsure how to programmatically differentiate requests based on whether the user is accessing the site by IP or domain name and serve different content accordingly.
Код: Выделить всё
How can I configure my Spring Boot application to detect whether the user is accessing via IP address or domain name and serve different content?
Should this logic reside in Java (Spring Boot) or should Angular handle the request and pass the URL to the backend for processing?
Are there specific libraries, configurations, or strategies I can use to achieve this, particularly when dealing with both Angular and static HTML pages in the same application?
Код: Выделить всё
The application is similar to Webmin, Plesk, or cPanel, where the control panel is accessed via IP while a public-facing website is served when a domain is used.
The Angular front end is primarily for server management (changing files, updating emails, etc.).
Подробнее здесь: https://stackoverflow.com/questions/715 ... boot-backe