[Blazor] Grafana DashBoard iframe URL http 로 가져오는 방법

null

Blazor Http로 실행

  • Blazor는 기본적으로 https, http 모두 실행되게 되어 있습니다.
  • 아래는 LaunchSetting.json 입니다.
{
  "profiles": {
    "GrafanaIframeTest": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "dotnetRunMessages": true,
      "applicationUrl": "https://localhost:7051;http://localhost:5207"
    }
}
  • 위 JSON 파일에서 applicationUrl을 보면 httpshttp가 있습니다.
  • Blazor를 기본적으로 실행하면 https로 접속하게 됩니다.

null

  • 그래서 접속하면 아래와 같은 로그가 출력 됩니다.
Mixed Content: The page at 'https://localhost:49157/counter' was loaded over HTTPS, but requested an insecure frame 'http://192.168.70.34:3000/d/TAi1Zb7Vz/overview?orgId=1'. This request has been blocked; the content must be served over HTTPS.
  • LaunchSetting.json 에 적혀있는 http로 접속해봅니다.
  • http로 접속했지만 주소가 https로 그대로 입니다.
  • 원인은 아래의 옵션으로 http로 접속하여도 https로 리다이랙션 되기 때문입니다.
  • Programs에서 아래의 옵션을 제거 합니다.
app.UseHttpsRedirection();

null

  • 위 옵션을 제거하고 실행 결과, 정상적으로 동작하는 것을 확인하였습니다.

정리

  • Blazor와 Grafana는 둘 다 https이거나 http여야 합니다..(https <-> http는 불가능)
  • Blazor에서 http로 접속하기 위해서는 app.UseHttpsRedirection(); 설정을 삭제해야 합니다.
  • Blaozr 에서 Grafana https 로 접속하기 위해서는, Grafana 의 정보를 http -> https 로 변경해야만 합니다.
728x90

이 글을 공유하기

댓글

Designed by JB FACTORY