Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom blazor endpoint url #38545

Closed
Bouke opened this issue Nov 20, 2021 · 1 comment
Closed

Allow custom blazor endpoint url #38545

Bouke opened this issue Nov 20, 2021 · 1 comment

Comments

@Bouke
Copy link
Contributor

Bouke commented Nov 20, 2021

Describe the bug

Blazor Server has some configuration possibilities to be hosted at a url other than _blazor. However there's a hard-coded path used that requires the hub to also be available under _blazor.

To Reproduce

app.UseEndpoints(
    endpoints =>
    {
        endpoints.MapBlazorHub("/_custom");
    });
<script src="/_framework/blazor.server.js" autostart="false"></script>
<script>
    Blazor.start({
        configureSignalR: builder => {
            builder.withUrl("_custom");
        }});
</script>

Workaround

Register the default url as well:

app.UseEndpoints(
    endpoints =>
    {
        endpoints.MapBlazorHub("/_custom");
        endpoints.MapBlazorHub();
    });

Exceptions (if any)

> GET /_blazor/initializers HTTP/1.1
< HTTP/1.1 404 Not Found

Further technical details

  • ASP.NET Core version: 6.0.100
@Bouke
Copy link
Contributor Author

Bouke commented Nov 20, 2021

After investigating some more I've concluded this to be user-error. After (correctly) setting <base href="/_custom" /> and dropping the custom JS startup, I can host blazor on a sub-path.

@Bouke Bouke closed this as completed Nov 20, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Dec 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant