-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
question: How to get client IP and custom headers in Lua filter #13457
Comments
Sorry, do you mean you have this information available on headers but it was not there when you tried to access it? FWIW, I think the information is available here: envoy/include/envoy/stream_info/stream_info.h Lines 474 to 479 in 319a9a6
|
I reconfirmed that the custom headers are available by
It seems that only |
@nic-chen sure. I think this is a good exercise for a new contributor. Do you want to try? I can try to help with providing guidance and review. Here is a complete (well, it's still missing docs) patch to expose downstream local address: https://github.com/envoyproxy/envoy/compare/master...dio:lua-streaminfo-addresss?expand=1, you can then add more getters to StreamInfoWrapper as you wish 🙂. |
Wow, so nice you are! I have always used JAVA, PHP, GO, Lua, JavaScript to work, and have never used C++. But I would like to try it out and learn, hoping to contribute more in the future. |
Do you mind if I push directly to your repo? Or should I submit the code on my repo? Then create a pr. |
@nic-chen I think I prefer for you to work on your own repo. Please note that the patch that I have exposes downstream local address, which probably not what you want. You can of course expose more, since the pattern will be the same (the remote ones: Have you successfully built envoy on your local? Please let me know if you have any issues. You can follow the official docs https://github.com/envoyproxy/envoy/blob/8a1d44422ba9ffa303c89b109b57e8889655b53a/bazel/README.md#building-envoy-with-bazel on building it, or the short one here (if you're on Linux (Debian-based) and want to use clang): https://gist.github.com/dio/9a7c826a2dbf004a81112db0d167d209. |
@dio I will try to build and make some test. It may take some time. There should be issues in this process that need your help, if so, I will ping you here. : ) |
I works on macOS, so took some time to build.. I think i could submit a pr today or tomorrow. |
I am developing a framework that support Apache APISIX plugins run directly in Envoy Lua filter without modify Envoy. #13307
But in the process, I found that some header values, such as client IP and custom headers, cannot be get in Lua filter.
I think client IP and custom headers should be very commonly used.
I might misreading/misunderstanding, but I don't know how to get them, please remind me, thank you !
The text was updated successfully, but these errors were encountered: