question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Best Practices: Error Responses from Inbound filters

See original GitHub issue

Are there best practices around how to respond from inbound filters. Let’s say for example, there is a inbound filter to check if a particular route exists and if not it needs to respond back with a 404. The only way to do this right now seems to be to create a new endpoint filter that’d return a 404 and then set that as the endpoint on the request context? Isn’t there a better way to do this? Like just throw an exception with say a 404 code or something?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
artgoncommented, Aug 23, 2018

Ok, I think I see what’s missing here. For both inbound and outbound filters, if you’re getting a body and you want to print it all out in the filter, you need to override the needsBodyBuffered() method and return true. See parent class here: https://github.com/Netflix/zuul/blob/2.1/zuul-core/src/main/java/com/netflix/zuul/filters/BaseFilter.java#L130

I’ll update the wiki to include this. Thanks for bringing it to my attention.

1reaction
ghostcommented, Jul 20, 2018

thanks ,@artgon no matter what content response ,the body is always null,if I have to setBody or setBodyAsText?so how can I get the body content from the original server?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inbound Filters | Sentry Documentation
Inbound data filters allow you to determine which errors, if any, Sentry should ignore. Explore these by navigating to [Project] > Project Settings...
Read more >
Inbound Filters | Sentry Documentation
Inbound data filters allow you to determine which errors, if any, Sentry should ignore. Explore these by navigating to [Project] » Project Settings...
Read more >
Enhanced filtering for connectors in Exchange Online
Learn how to use Enhanced Filtering for Connectors (also known as skip ... Properly configured inbound connectors are a trusted source of ...
Read more >
Best Practices for Designing a Pragmatic RESTful API
Learn the best practices to make an API that is easy to adopt and pleasant ... a consumable error payload; Effectively use HTTP...
Read more >
How Spam Filters Work (And How to Stop Emails Going to ...
Gmail built its brand in part on having the best spam filter that would ... to filter and quarantine both inbound and outbound...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found