使用Traefik将http和https重定向到Vue应用

我想在vue docker容器的8080端口上重定向http和https请求。

为此,我尝试使用Traefik,但我不太清楚。

这是我实际的traefik.toml和docker-compose.yml文件:

traefik.toml:

<nav class="nav navbar-expand-sm navbar-dark justify-content-between justify-content-sm-start">
    <a class="navbar-brand" href="" id="homeOverride"> <span class="overrideFonts"> Home </span> </a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse flex-grow-0 flex-sm-grow-1" id="navbarSupportedContent">
      <ul class="navbar-nav mr-auto">

        <li class="nav-item">
          <a class="nav-link" href=""> <span class="overrideFonts"> Projects </span> </a>
        </li>

        <li class="nav-item">
          <a class="nav-link" href=""> <span class="overrideFonts"> Contact </span> </a>
        </li>

      </ul>
    </div>
  </nav>

docker-compose.yml:

defaultEntryPoints = ["http","https"]

[web]
address = ":7777"
  [web.auth.basic]
  users = ["admin:$apr1$Qai983Ya$XNOr.GZjn3Uggtu3iHqbY/"]

[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
      entryPoint = "https"
  [entryPoints.https]
  address = ":443"
    [entryPoints.https.tls]

[acme]
email = "mail@domain.com"
storage = "acme.json"
entryPoint = "https"
onHostRule = true
onDemand = true

我要做什么是什么问题?我在http和https请求中收到404错误。

zhanglin711 回答:使用Traefik将http和https重定向到Vue应用

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3084678.html

大家都在问