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

In zuul 2.x sample demo, a request routing to nginx-backend http service always got 404 error #434

Open
whbg opened this issue May 10, 2018 · 9 comments

Comments

@whbg
Copy link

whbg commented May 10, 2018

Condition:
1.disable eureka, and then
2.choose ConfigurationBasedServerList

We found this error was relation to 'Host' header forward to real service. Or i did incorrect configuration(see below bold line)?

@whbg
Copy link
Author

whbg commented May 10, 2018

#Instance env settings

region=us-east-1
environment=test

#Eureka instance registration for this app

#Name of the application to be identified by other services
eureka.name=zuul

#The port where the service will be running and serving requests
eureka.port=7001

#Virtual host name by which the clients identifies this service
eureka.vipAddress=${eureka.name}:${eureka.port}

#For eureka clients running in eureka server, it needs to connect to servers in other zones
eureka.preferSameZone=false

#Don't register locally running instances.
eureka.registration.enabled=false

#Disable eureka
eureka.validateInstanceId=false

#Loading Filters
zuul.filters.root=zuul-sample/src/main/groovy/com/netflix/zuul/sample/filters
zuul.filters.locations=${zuul.filters.root}/inbound,${zuul.filters.root}/outbound,${zuul.filters.root}/endpoint
zuul.filters.packages=com.netflix.zuul.filters.common

#Load balancing backends with Eureka

eureka.shouldUseDns=true
eureka.eurekaServer.context=discovery/v2
eureka.eurekaServer.domainName=discovery${environment}.netflix.net
eureka.eurekaServer.gzipContent=true

eureka.serviceUrl.default=http://${region}.${eureka.eurekaServer.domainName}:7001/${eureka.eurekaServer.context}

#api.ribbon.NIWSServerListClassName=com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList
#api.ribbon.DeploymentContextBasedVipAddresses=api-test.netflix.net:7001

#Load balancing backends without Eureka
#disable auto service discovery
eureka.shouldFetchRegistry=false

api.ribbon.listOfServers=http://xx.com:80 ##{nginx-backend hostname}

api.ribbon.UseIPAddrForServer=false
api.ribbon.client.NIWSServerListClassName=com.netflix.loadbalancer.ConfigurationBasedServerList ##{diff}
api.ribbon.DeploymentContextBasedVipAddresses=api-test.netflix.net:7001

@whbg whbg changed the title In zuul 2.x, a request routing to nginx-backend http service always got 404 error In zuul 2.x sample demo, a request routing to nginx-backend http service always got 404 error May 10, 2018
@artgon
Copy link
Contributor

artgon commented May 10, 2018

Which host header are you getting on your backend?

@whbg
Copy link
Author

whbg commented May 11, 2018

2018-05-11 10 01 42

configuration is , api.ribbon.listOfServers=http://xx.com:80 backend Host header is Host:localhost:7001(it should be Host:xx.com:80)

@artgon
Copy link
Contributor

artgon commented May 11, 2018

That's not how proxies are supposed to behave. You have to maintain the host header from the original request otherwise your service has no idea where the request came from.

@artgon artgon added the 2.x label May 11, 2018
@liangGTY
Copy link
Contributor

liangGTY commented May 26, 2018

I think it's better if the proxy overrides the host header to get the host from ribbon.listOfServers? @artgon

@wongcoekfai
Copy link

And so? how to fix this problem?

@SMakhrov
Copy link

I have the same problem. @artgon please help to solve this.

@artgon
Copy link
Contributor

artgon commented Nov 30, 2020

If you want to change the outbound host header, you can add a filter that modifies the inbound request headers.

Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants