fix: #125 Console Poll URL not respecting PathPrefix#4
Merged
bhavishyachandra merged 2 commits intoMay 27, 2026
Merged
Conversation
There was a problem hiding this comment.
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
DynamicJsDispatcherto buildconsolePollUrlvia HangfireUrlHelperinstead ofRequest.PathBase. - Added xUnit coverage for poll URL generation across default path base, custom path base, and
PrefixPathcases. - 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); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes the console polling when using hangfire with the PathPrefix used to work with load balancers.
Summary:
Validation:
Related to the issue: 125