Closed jesskfullwood closed 5 years ago
could you explain why do you need to set headers?
If you need to "modify" headers, you could simply make your own struct, on which you have way more control, and implement From<HttpRequest>
and Into<HttpResponse>
. I'm using actix-web kinda like a proxy too (http server in front of a distributed event-driven microservice architecture) and that's what I did, works wonders.
I am planing to introduce new type of middleware, which will be able to modify request. but timeframe is 3-4 weeks
In my case, I'm hacking around a corporate firewall which strips certain headers. I am adding them back in.
I could do this at the request handler level but it's easier to do as a middleware (but not a big deal to work around).
@fafhrd91 Do we plan to change it?
Yes, we do. We need to switch to actix-http and merge actix-web2
@fafhrd91 any updates on that? How can I change request headers within proxy middleware in Actix-Web 0.7.18
?
@fafhrd91 Is it in progressing?
i am working on new version, this will take some time
it is possible in 1.0, i will update docs soon
With the
HttpRequest
refactor, I can no longer figure out a way to modify the request headers inside a middleware. This is necessary as I am usingactix-web
as a proxy.I understand that
HttpRequest
is now supposed to be immutable, but it would be useful to have some guidance on whether what I aim to achieve is still possible. The Middleware docs still have my use case as a motivating example, but it no longer compiles.(I'm on the latest master, 82920)