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

Custom status code when no route found #107

Closed
discobean opened this issue Jun 1, 2016 · 5 comments
Closed

Custom status code when no route found #107

discobean opened this issue Jun 1, 2016 · 5 comments
Milestone

Comments

@discobean
Copy link

Hi, currently fabio returns a 404 if no route is found.

We have nginx in front that routes a 404 to another fabio instance in DC2 if DC1 service is unavailable. But this causes a problem if a microservice responses with a legitimate 404 in DC1 as the request would be routed twice by nginx.

How could this use case be supported? I was hoping for a custom response code if no route is found, but I could not find anything in the documentation.

@magiconair magiconair changed the title Different HTTP Response code if no route found Custom status code when no route found Jun 2, 2016
@magiconair magiconair added this to the 1.1.4 milestone Jun 2, 2016
magiconair added a commit that referenced this issue Jun 2, 2016
When no route was found fabio returns status code
404 Not Found which may not be suitable in situations
where 404 has a valid meaning.
@magiconair
Copy link
Contributor

Good point. I've added a patch which adds this feature. Let me know if this works.

@magiconair
Copy link
Contributor

I'm also thinking whether this is something that fabio could do natively. It could determine the fabio instances in another data center and route requests for failed routes there. This would save another roundtrip since fabio knows which routes it has.

Can you explain your use case a bit more and which other functions your nginx is serving?

@discobean
Copy link
Author

discobean commented Jun 2, 2016

We use nginx for offloading SSL, ACLs, rewrites and these sorts of more complicated tasks.

If fabio were to route to another DC then it would solve another problem we have - where if one microservice fails in DC1 all nginx routes all microservices attached to that upstream to DC2.

I'll test your patch next week and let you know. Thanks so much as usual!

@magiconair
Copy link
Contributor

I'm going to merge this one. The change is simple enough. Please re-open if this doesn't work as intended.

magiconair added a commit that referenced this issue Jun 8, 2016
When no route was found fabio returns status code
404 Not Found which may not be suitable in situations
where 404 has a valid meaning.
@discobean
Copy link
Author

Hi, can confirm this now works! 👍

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

2 participants