Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

根据域名进行区分的转发 #9

Closed
beetlex-io opened this issue Mar 15, 2019 · 5 comments
Closed

根据域名进行区分的转发 #9

beetlex-io opened this issue Mar 15, 2019 · 5 comments
Labels

Comments

@beetlex-io
Copy link
Owner

例如: 服务器 192.168.2.3 IIS: 用户接口 api1.server.com:80 组织接口 api2.server.com:80
配置后只会转发到其中一个接口。nginx也是不能通过域名区分。

@beetlex-io
Copy link
Owner Author

组件对同一个URL接口,来源于不同域名可以制定不同的转发,URL制定如下:
api1.server.com|/user.*

api2.server.com|/user.*

@eddyyuen
Copy link

这个配置是把相同url的转发到不同的server。
我的需求是几个api server部署在同一台服务器的同一个端口(例如IIS)。访问时通过域名进行区分。
但是fasthttpapi连接api server是把域名解析为IP后进行连接的。这样IIS就不能区分转发后访问的是哪一个域名,通常就会默认解析为第一个。

@beetlex-io
Copy link
Owner Author

@eddyyuen
按道理不存在这情况,Bumblebee转发的过程会带上访问Bumblebee的host头信息

@eddyyuen
Copy link

@eddyyuen
按道理不存在这情况,Bumblebee转发的过程会带上访问Bumblebee的host头信息

是我的逻辑错了。因为访问的两个不同域名的接口,正因为带上了host头信息,IIS只认这个host。

@beetlex-io
Copy link
Owner Author

@eddyyuen
是你想host信息是你配置服务的域名而不是请求的域名?要是这样只能通过代码扩展才能实现,在0.9之前的版本其实可以通过AgentRequesting事件中设置,在事件里得到当前agentserver的配置的host,然后设置到request.Header中即可。
新版本看
https://github.com/IKende/Bumblebee/blob/master/Bumblebee.BaseSample/Program.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants