You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tinkered with integrating the ReverseProxy plug within a Phoenix app - using forward so that just a few selected endpoints would be proxied upstream.
However, I came across an issue where Plug's read_body/2 is being called earlier in the pipeline (inside Phoenix parsers), thus rendering the ReverseProxy call to read the body useless.
Any idea on a way to overcome this issue?
The text was updated successfully, but these errors were encountered:
Spent a little time making this work in phoenix. read_body/2 has long since been called in phoenix. They key is to use body_params. Just call Poison.encode!(conn.body_params) rather than calling Conn.read_body(conn). (My actual change is to see if body_params exists and call Poison.encode!/1 if it does otherwise do the current code path using read_body/2.)
@baldmountain Thanks for looking into this! If you're willing, be sure to submit a PR with your changes. I'd love for you to get credit here. If you're unable, I'll definitely be sure to attribute you with the solution.
I have tinkered with integrating the ReverseProxy plug within a Phoenix app - using
forward
so that just a few selected endpoints would be proxied upstream.However, I came across an issue where Plug's
read_body/2
is being called earlier in the pipeline (inside Phoenix parsers), thus rendering the ReverseProxy call to read the body useless.Any idea on a way to overcome this issue?
The text was updated successfully, but these errors were encountered: