Open Closed

Reverse Proxy question #9990


User avatar
0
sghorakavi@cpat.com created
  • Steps to reproduce the issue: Created a sample ABP project Auth server : https://localhost:44339 Host Server : Https://localhost:44342 WebServer : Https://localhost:44378

Goal is to make : Hostserver: Https://localhost:44378/api AuthServer: Https://localhost:44378/auth webServer: Https://localhost:44378

I tried reverse proxy but it is not working.


2 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent

    To achieve your goal of exposing multiple ABP services (Host, Auth, Web) under a single domain and port using a reverse proxy, you need to ensure that:

    1. Each backend service is configured to work behind a reverse proxy.
    2. Path-based routing is set up in your reverse proxy (e.g., IIS, Nginx, or YARP).
    3. Forwarded headers are correctly handled in your ABP applications.

    Key Steps

    1. Configure Forwarded Headers Middleware

    In each ABP application's Startup.cs (or Program.cs for .NET 6+), add the Forwarded Headers Middleware at the top of the middleware pipeline:

    app.UseForwardedHeaders(new ForwardedHeadersOptions
    {
        ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
    });
    

    This ensures the application correctly interprets the original request's scheme and host.

    2. Reverse Proxy Path Mapping

    Configure your reverse proxy to map paths as follows:

    • /api → Host Server (https://localhost:44342)
    • /auth → Auth Server (https://localhost:44339)
    • / → Web Server (https://localhost:44378)

    For example, in IIS, you can use URL Rewrite rules or in YARP (Yet Another Reverse Proxy) you can define routes in appsettings.json.

    3. Update ABP Configuration

    • Set App:SelfUrl, AuthServer:Authority, and RemoteServices:Default:BaseUrl in each app's appsettings.json to use the public-facing URL (https://localhost:44378).
    • Ensure CORS and redirect URIs are set to the single domain.

    4. Test and Debug

    • Make sure all static files, cookies, and authentication flows work as expected.
    • If you encounter issues with authentication or redirects, double-check the forwarded headers and public URLs.

    Reference

    This approach is required for correct operation behind a reverse proxy, especially for authentication and URL generation.


    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    sghorakavi@cpat.com created

    It is not working. I tried this as wellhttps://abp.io/docs/latest/deployment/forwarded-headers

    getting error:

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on October 14, 2025, 08:24