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

HTTP filters that put after envoy.router don't work but envoy can still boot up with that configuration #7767

Closed
KenjiChao opened this issue Jul 30, 2019 · 8 comments · Fixed by #7779
Assignees
Labels
area/docs enhancement Feature requests. Not bugs or questions.
Milestone

Comments

@KenjiChao
Copy link

KenjiChao commented Jul 30, 2019

Title: HTTP filters that put after envoy.router don't work but envoy can still boot up with that configuration

Description:

I'm trying to add the buffer filter to the http filters list so that we can set max request size. What I observed is that if I put the buffer filter after envoy.router filter, I don't get a 413 response when sending a request with a large file, but envoy can still boot with that configuration. On the other hand, if I reverse the order and put envoy.router filter after the buffer filter, it works as expected.

It's weird to me that yaml configuration still compiles and envoy is able to boot up with that configuration while the router filter doesn't propagate requests to subsequent filters. I can't seem to find anything in the docs implying this behavior. At least I would expect the router filter doc be updated saying that it should be the last one in the http filters list.

Config:

The one that's not working:

...
                http_filters:
                  - name: envoy.router
                    typed_config: {}
                  - name: envoy.buffer
                    config:
                      max_request_bytes: 30000000
...

The one that's working:

...
                http_filters:
                  - name: envoy.buffer
                    config:
                      max_request_bytes: 30000000
                  - name: envoy.router
                    typed_config: {}
...
@KenjiChao KenjiChao changed the title HTTP filters that put after envoy.router don't work but the yaml configuration still compiles HTTP filters that put after envoy.router don't work but envoy can still boot up with that configuration Jul 30, 2019
@snowp
Copy link
Contributor

snowp commented Jul 31, 2019

@mattklein123 Do you think it would make sense to add some kind of (maybe optional) validation that errors out if there are filters after a terminal filter? Or should we just document the requirements?

@mattklein123
Copy link
Member

@snowp see #7779.

@alyssawilk in thinking about this a bit more, I wonder if we should do this:

  1. Add a virtual function on the filter factory, isTerminalFilter() which defaults to false.
  2. Set it to true for terminal filters
  3. Base the checks you added on that? WDYT?

@alyssawilk
Copy link
Contributor

Darn it, you called me on my slippery slope.
My main concern for this is that I'm not actually sure which filters are terminal other than tcp_proxy, router, and HCM. If you can advise there, I'll accept doing the less hacky solution :-)

@mattklein123
Copy link
Member

@alyssawilk I think those three, and it's a pretty trivial change that then puts this in the hands of the filter writer, so it seems more future proof to me?

@mattklein123 mattklein123 added this to the 1.12.0 milestone Jul 31, 2019
@mattklein123 mattklein123 added the enhancement Feature requests. Not bugs or questions. label Jul 31, 2019
@snowp
Copy link
Contributor

snowp commented Jul 31, 2019

+1 on making it part of the API, I imagine the redis/thrift filters also fall into this category

@mattklein123
Copy link
Member

Ah yes, redis/thrift also.

@mattklein123
Copy link
Member

Also Dubbo

@alyssawilk
Copy link
Contributor

This is where I knew I'd miss one :-P

OK, new PR coming up. Ironically I hadn't even seen this issue filed, I'd been commenting over on 7738 where the router was the first of three on the first pass, and second of three on their next try. So yeah, this comes up a bunch.

alyssawilk added a commit that referenced this issue Aug 13, 2019
…ective chains (#7779)

An (no longer annoyingly one-off) solution to the common problem folks run into with Envoy configs where they add their filters behind the router filter and don't get why things aren't working. Ditto for HCM, tcp_proxy etc for L4

Risk Level: Low (except for folks with broken config)
Testing: new UT
Docs Changes: n/a
Release Notes: n/a
Fixes #7767

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs enhancement Feature requests. Not bugs or questions.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants