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

Aspire Dashboard HTTPS and SINGLE PORT hosting of both OTLP and Blazor app #2756

Closed
iphdav opened this issue Mar 10, 2024 · 2 comments · Fixed by #3045
Closed

Aspire Dashboard HTTPS and SINGLE PORT hosting of both OTLP and Blazor app #2756

iphdav opened this issue Mar 10, 2024 · 2 comments · Fixed by #3045
Assignees

Comments

@iphdav
Copy link

iphdav commented Mar 10, 2024

I have successfully modified the project to host both OTLP and the Blazor app on a single port. This allowed hosting as an Azure App Service with HTTPS used for both the received telemetry and the blazor dashboard app.

@DamianEdwards Is there a reason we cannot make this the default - only requiring a single port for the dashboard project? Or at least could we provide an option to start it up in this way to ensure we can host the dashboard with a single HTTPS port that handles both the OTLP inbound telemetry plus the blazor app.

Note: To deploy such a solution, you need to first follow the steps here to enable GRPC on the Azure App Service for Windows. This is a preview feature:
https://github.com/Azure/app-service-linux-docs/tree/master/HowTo/gRPC/Windows

Note that I removed the "throw" inside the OtlpInterceptor.cs.

I started Kestrel up like this:

        builder.WebHost.ConfigureKestrel(kestrelOptions =>
        {
            kestrelOptions.ListenLocalhost(8080, options =>
            {
                if (builder.Environment.IsDevelopment()) options.UseHttps();
                options.Protocols = HttpProtocols.Http2;
                options.UseOtlpConnection();
            });
        });

I only started it using HTTPS in DEV mode, because I used the Azure Web App TLS termination in production.

I am not sure if this was needed, but I also added this to the appSettings.json:

  "Kestrel": {
    "EndpointDefaults": {
      "Protocols": "Http2"
    }
  }

In summary, when deployed to an Azure App Service, this allows everything to run under TLS and only needs a single port.

Note: I did attempt to get this running on the Linux App Service, but hit a few issues and did not get time to resolve.

@JamesNK
Copy link
Member

JamesNK commented Mar 10, 2024

@DamianEdwards Is there a reason we cannot make this the default - only requiring a single port for the dashboard project? Or at least could we provide an option to start it up in this way to ensure we can host the dashboard with a single HTTPS port that handles both the OTLP inbound telemetry plus the blazor app.

Separate ports are required when HTTPS isn't used. gRPC requires HTTP/2, and an unsecured port can't do HTTP/1.1 + HTTP/2.

But I think it is reasonable to detect if the browser endpoint and OTLP endpoint are configured to the same port and support running the app on one port.

@iphdav
Copy link
Author

iphdav commented Mar 10, 2024

@JamesNK Thanks, it would be great if you can detect single port configuration and have it work out of the box.

Regarding your comments about HTTPS requirements for single port use: I did stumble onto this, and configured my version to host on 1-port via HTTPS when running locally. But I configured it to use HTTP, still with 1-port, when deployed to the Azure App Service, because Azure terminates the TLS connection before it hits the app. I also turned on HTTP2 everywhere (on the azure web app config and in the kestrel config).

Anyway, I can report it works great on a single port deployed to the Azure App Service all running on HTTPS, but you do need to turn on the preview GRPC proxy stuff on the azure app service first.

@JamesNK JamesNK self-assigned this Mar 20, 2024
@JamesNK JamesNK removed the untriaged label Mar 20, 2024
@JamesNK JamesNK added this to the preview 5 (Apr) milestone Mar 20, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants