Skip to content

fix: #125 Console Poll URL not respecting PathPrefix#4

Merged
bhavishyachandra merged 2 commits into
Hangtools:masterfrom
gilmar-sales:fix/console-poll-url
May 27, 2026
Merged

fix: #125 Console Poll URL not respecting PathPrefix#4
bhavishyachandra merged 2 commits into
Hangtools:masterfrom
gilmar-sales:fix/console-poll-url

Conversation

@gilmar-sales

@gilmar-sales gilmar-sales commented May 25, 2026

Copy link
Copy Markdown

This PR fixes the console polling when using hangfire with the PathPrefix used to work with load balancers.

Summary:

  • Created some tests to ensure that nothing would break (created the same internal Stubs in Hangfire).
  • Implemented the fix using Hangfire's UrlHelper class and add more one test to cover this.

Validation:

  • This will need an basic configuration with NGINX or one Gateway with PrefixPath configured like 1110

Related to the issue: 125

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Hangfire.Console’s dynamic JS config so the console polling URL is generated using Hangfire’s dashboard URL construction (respecting DashboardOptions.PrefixPath / path prefix scenarios behind proxies/load balancers).

Changes:

  • Updated DynamicJsDispatcher to build consolePollUrl via Hangfire UrlHelper instead of Request.PathBase.
  • Added xUnit coverage for poll URL generation across default path base, custom path base, and PrefixPath cases.
  • Introduced minimal dashboard/storage response/context stubs to support dispatcher tests.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/Hangfire.Console.Tests/Stubs/JobStorageStub.cs Adds a minimal JobStorage stub needed to construct a DashboardContext in tests.
tests/Hangfire.Console.Tests/Stubs/DashboardResponseStub.cs Adds a DashboardResponse stub to capture dispatcher output into a stream for assertions.
tests/Hangfire.Console.Tests/Stubs/DashboardContextStub.cs Adds a DashboardContext stub wiring request/response and options for URL-generation tests.
tests/Hangfire.Console.Tests/Dashboard/DynamicJsDispatcherFacts.cs Adds dispatcher tests validating poll interval formatting and poll URL generation (including PrefixPath).
src/Hangfire.Console/Dashboard/DynamicJsDispatcher.cs Switches poll URL generation to UrlHelper.To("/console/") to respect path prefix configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +25 to +28
public override Task WriteAsync(string text)
{
return Body.WriteAsync(Encoding.UTF8.GetBytes(text), 0, text.Length);
}
@bhavishyachandra bhavishyachandra merged commit 3de3f38 into Hangtools:master May 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants