Skip to content

ResQueue static files redirected by custom middleware in multi-tenant applications #26

@risperdal

Description

@risperdal

Issue Description:

Problem

ResQueue works correctly when accessing the main dashboard at /resqueue, but the internal JavaScript files fail to load because they are being intercepted and redirected by our application's custom middleware.

Environment

  • ASP.NET Core application with multi-tenant architecture
  • Custom middleware that redirects requests without tenant context to appropriate start pages
  • ResQueue configured with app.UseResQueue("resqueue") in development environment

What happens

  1. /resqueue loads successfully (main dashboard page)
  2. ResQueue tries to load /resqueue-4e8efb80-6aae-496f-b8bf-611b63e725bc/config.js
  3. Our custom redirect middleware intercepts this request and redirects it to the home page
  4. JavaScript files fail to load, breaking the ResQueue UI functionality

Root Cause

Our middleware runs after UseResQueue() and checks if requests have tenant context. Since ResQueue's static files and config endpoints don't have tenant context, they get redirected.

Current Workaround

We've implemented two solutions:

  1. Added AllowTenantlessRouteAttribute metadata to ResQueue API endpoints via the configureApi parameter
  2. Added path-based bypass in our middleware for /resqueue-4e8efb80-6aae-496f-b8bf-611b63e725bc/* paths

Suggested Enhancement

It would be helpful if ResQueue could provide a way to:

  1. Apply custom metadata to all its endpoints and static file routes

This would make it easier for applications with custom middleware to properly handle ResQueue routes without hardcoding the internal GUID.

Code Example

// This should affect static file too but because static file is mapped via app.MapGet, i cant add metadata to it
app.UseResQueue("resqueue", routeGroup => 
{
    routeGroup.WithMetadata(new AllowTenantlessRouteAttribute());
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions