1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Handling IP vs. Domain Name Requests with Angular Frontend and Spring Boot Backend

Discussão em 'Angular' iniciado por Collin Short, Novembro 9, 2024 às 21:23.

  1. Collin Short

    Collin Short Guest

    I'm working on a Spring Boot application with an Angular frontend that serves as a basic login portal. The login portal uses encrypted credentials and click verification to authenticate users. My goal is to differentiate behavior based on whether the user accesses the application via the server's IP address or a domain name. Desired Functionality:

    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.


    What I’ve Done:

    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.


    Key Questions:

    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?


    Additional Information:

    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.).


    Any guidance or suggestions on how to approach this would be greatly appreciated!

    Continue reading...

Compartilhe esta Página