解决spring cloud zuul与nginx的域名转发问题

nginx配置

解决spring cloud zuul与nginx的域名转发问题_第1张图片

proxy_set_header Host $http_host;

spring zuul配置

#设置转发时携带域名
  zuul:
  add-host-header: true
 #设置不忽略头信息,否则无法写入cookie
  sensitive-headers: 

坑:给zuul网关添加nginx转发携带域名

Zuul问题

问题描述

给zuul的配置文件添加下列不起作用

zuul:
  add-proxy-headers: true # 注意这个proxy

问题解决

是添加错了!!!

 # add-proxy-headers: true 是错的
 add-host-header: true # 才是对的

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

你可能感兴趣的:(解决spring cloud zuul与nginx的域名转发问题)