Skip to content
This repository was archived by the owner on Jul 7, 2026. It is now read-only.
This repository was archived by the owner on Jul 7, 2026. It is now read-only.

Unable to configure app for use behind Nginx reverse proxy #119

Closed

Description

@SysEngDan

I'm running QT with Docker, using image d4software/querytree:c63e66f. I have many, many website running behind the reverse proxy which work without issue. When configuring QT with a simple, basic proxy_pass config, the QT redirects to the Docker service name. It seems like out of the box, QT doesn't honor X-Forwarded-For and Proto headers.

Any advice?

        location / {
                resolver 127.0.0.11 valid=10s;
                real_ip_header proxy_protocol;
                set_real_ip_from 192.168.30.1/32;
                set $upstream reports_example_com_php;
                proxy_set_header X-Real-IP $proxy_protocol_addr;
                proxy_set_header X-Forwarded-Host $host;
                proxy_set_header X-Forwarded-Server $host;
                proxy_set_header X-Forwarded-For $proxy_protocol_addr;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_pass http://$upstream;
        }

Activity

  1. PandelisZ commented on Feb 4, 2021

    @PandelisZ
    Member

    Thanks for the great feedback.

    This is definately something that we should support as its pretty much the standard way of routing in the cloud native era.

  2. SysEngDan commented on Feb 5, 2021

    @SysEngDan
    Author

    Should this be considered a bug since proxy support is already written in readme.md?

    “For use in production environments, QueryTree should be run behind a reverse proxy such as nginx. For more information on hosting QueryTree using nginx see: https://docs.microsoft.com/en-us/aspnet/core/publishing/linuxproduction

  3. PandelisZ commented on Feb 5, 2021

    @PandelisZ
    Member

    This project was originally refactored form a windows only .NET stack back in the day so theres definately lots of nice .NET core features we've missed.

    Looks like it s amatter of enabling the forwarding headers. It's not something that's automatically taken care of:

    using Microsoft.AspNetCore.HttpOverrides;
    
    app.UseForwardedHeaders(new ForwardedHeadersOptions
    {
        ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
    });
    
    app.UseAuthentication();
    
  4. added a commit that references this issue on Feb 5, 2021
    91a96d4
  5. PandelisZ commented on Feb 5, 2021

    @PandelisZ
    Member

    @SysEngDan could you give d4software/querytree:reverse-proxy a go?

  6. SysEngDan commented on Feb 6, 2021

    @SysEngDan
    Author

    I gave it a shot but I'm still saying the same response. What happens is that the application redirects from the initial request (https;//reports.example.com) to this https://reports_example_com_app/Account/Login?ReturnUrl=%2F (that's the docker service name). This tells me that the application isn't honoring X-Forwarded-Host (which contains the original hostname).

  7. stale commented on Apr 19, 2022

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions