NGINX如何将变量从server_name传递给proxy_pass?

时间:2020-09-03 10:29:13

标签: nginx

当前,我正在使用如下的nginx配置:

@PostMapping("/signup")
fun authenticateSignUp(@RequestBody request: RegisterUserCommand): CompletableFuture<String> {
  val command = request.copy(userId = ObjectId.get().toHexString(), balance = BigDecimal.ZERO)
  return commandGateway.send<String>(command)
}

但是我想更改上述配置以支持url中的动态端口,例如:

server { listen 80; server_name stage.mysite.eu; location / { proxy_pass http://localhost:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } }

port-3001.stage.mysite.eu -> http://localhost:3001

我尝试配置没有成功:

port-3002.stage.mysite.eu -> http://localhost:3002

如何更改以上配置以满足我的要求?

0 个答案:

没有答案
相关问题