anycable-go icon indicating copy to clipboard operation
anycable-go copied to clipboard

Cookies filter

Open palkan opened this issue 3 years ago • 3 comments

Context

When using cookie-based authentication, we send the value of the Cookie header in every RPC request. Cookies could contain a lot of data (especially, when using trackers, etc.), but the application usually needs a few of them. The proposal is to make it possible to select only specific cookies and reduce the RPC payload size.

Proposal

Add --proxy-cookies option, which accepts the comma-separated list of keys to send to the RPC server:

anycable-go --headers=cookies --proxy-cookies=app_session_id,user_id

Given the original cookie value "app_session_id=xqs;_ga=bla;_another_tracker=1231231;user_id=42;", at the RPC server side, we should have request.env.headers["cookie"] == "app_session_Id=xqs;user_id=42;".

palkan avatar Oct 04 '22 01:10 palkan

hey @palkan can I help with this one?

rafaelrubbioli avatar Oct 04 '22 14:10 rafaelrubbioli

Hey @rafaelrubbioli!

Sure, you're welcome! Feel free to ask any questions here.

palkan avatar Oct 10 '22 02:10 palkan

hey @palkan I opened a PR for this! https://github.com/anycable/anycable-go/pull/157

rafaelrubbioli avatar Oct 10 '22 21:10 rafaelrubbioli