-
Notifications
You must be signed in to change notification settings - Fork 596
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
Replace synthetic headers with request attributes #911
Comments
I think it would be nice to make the |
So your proposal @ktoso is hide the synthetic headers and only retrieve them when is explicitly said, right? |
Yes. But these synthetic headers are added after the request was received by the server. IMO users should be confident that what they see is what was actually sent by the client (or. intermediate proxies).
When users log requests/responses they'll see them anyway. I'm just saying that treating message headers as a store for everything but the kitchen sink might not scale as there will always be demand for attaching additional infos to messages. This discussion comes up every once in a while (partly because of me bringing this up) so I thought opening a ticket might be best to discuss improvements. |
No, the intent is to completely hide them from users unless accessed directly using a We can after all override the toString of the case class. I think this should be possible to pull of in a binary compatible way. |
I was confused because you commented on #888 and that one is about custom headers sent by the client (at least in the example there) |
Ah, then I said nothing
…On Tue, Feb 28, 2017, 11:20 André Rüdiger ***@***.***> wrote:
Yes. I was just reacting to @jypma <https://github.com/jypma>'s comment
<#888 (comment)> over
there.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#911 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADLuC8dh3zF8_ZdQuZu-IpZRKyylzB0Nks5rg_TvgaJpZM4MOLVZ>
.
|
From my point of view, the "internal" headers only exist because no arbitrary request attribute feature existed yet. There are two strong arguments here for refactoring the synthetic headers to become request attributes:
However, given binary compatibility, hiding the current internal ones as best we can (e.g. using the flag) improve things. I feel that in the end, |
I agree except for the auth ones, I still think those are fine as headers, as in my opinion, they are not synthetic but just custom ones and are definitely send by the client. Am I missing or misinterpreting something? |
Oh sure you're right about parsing and interpreting the actual |
I'll get back here after some more pondering, but tracing for example would end up being a header anyway since that's how all |
OK, now I understand your concerns and I tend to agree, conceptually, they belong to attributes. |
The set of headers to use is not fixed to any particular use case and scope. Some headers are only used for proxies, some are only allowed to hop-by-hop, some are user-defined, etc. It's generic enough to carry all kinds of metadata for HTTP messages. Also, spray and akka-http never represented the request or response headers as seen on the wire. Our model is already an interpretation of the raw data we read. Regardless whether it's our internal headers or whatever headers proxies or reverse proxies added, you cannot assume to understand all headers that are in the list as you are not in control of generating the headers. In summary, I don't share your fear that additional headers confuse people or are inappropriate to store arbitrary metadata. (I actually haven't never seen someone complaining about internal headers but that doesn't have to say anything, but maybe, @ktoso, have you heard about reported issues?) That said, I'm not strongly opposing the idea of introducing something like request / response attributes. What I wouldn't like to see is having to duplicate the header infrastructure to access attributes (Java/Scala model and directives). Also, there's the practical problem that we cannot compatibly evolve the Scala HttpRequest / HttpResponse classes to introduce attributes in a proper way. |
I don't want to limit what can be put into headers. Users should be able to add anything they want. I'm just saying that we're exposing implementation details that are of no value to the users.
But it's a rather close representation of what was transferred.
Agreed. |
Poking an old issue here, but I still run up against it pretty often (particularly the custom user information case @jypma mentioned). We also see some fairly elaborate articles around the web to add this functionality indicating there is demand for it. What are everyone's thoughts on adding something like def attributes: immutable.Seq[RequestAttribute] on |
They are confusing in logs or when debugging and have to be manually filtered out when proxing reuqests.
The text was updated successfully, but these errors were encountered: