dotnet/try

URL returned by GenerateEditorPageAsync does not honor referrer scheme

dalehhirt opened this issue · 3 comments

Describe the bug

When accessing /editor, the url generated does not honor the https:// scheme. Recommend using an environment variable that can be set if running in a container to https. See line 14 of src\Microsoft.TryDotNet\ContentGenerator.cs

Did this error occur while using dotnet try or online?

  • dotnet-try
  • [ x] online

What kind of error was it?

  • User Interface (UI): For example the output never displayed
  • Service Error: For example "The service is temporarily unavailable. We are working on it"
  • [x ] Other:

app.bundle.js:2 Mixed Content: The page at 'https://.net/editor?enableLogging=true' was loaded over HTTPS, but requested an insecure frame 'http://.net/wasmrunner'. This request has been blocked; the content must be served over HTTPS.

Screenshots

If applicable, add screenshots to help explain your problem.

Please complete the following:

  • OS
    • [x ] Windows 10
    • macOS
    • Linux (Please specify distro)
    • iOS
    • Android
  • Browser
    • [ x] Chrome
    • [ x] Edge
    • Safari

Sample change in ContentGenerator.cs starting at line 14:

        var scheme = Environment.GetEnvironmentVariable("TRY_DOT_NET_REQUEST_SCHEME") ?? request.Scheme;
        var hostUri = new Uri($"{scheme}://{request.Host.Value}", UriKind.Absolute);

Do you plan to PR this?

Do you plan to PR this?

I can. Will do that in a few minutes.