Merge branch 'fix-chunked-encoding' into 'main'
fix(proxy): chunked encoding mustn't set content-length header See merge request kaihuri/mobilizon!1604
This commit is contained in:
@@ -187,9 +187,13 @@ defmodule Mobilizon.Web.ReverseProxy do
|
||||
@spec response(Plug.Conn.t(), any(), String.t(), pos_integer(), list(tuple()), Keyword.t()) ::
|
||||
Plug.Conn.t()
|
||||
defp response(conn, client, url, status, headers, opts) do
|
||||
headers = build_resp_headers(headers, opts)
|
||||
# Fix HTTP/1.1 protocol violation: content-length can't be combined with chunked encoding
|
||||
headers = Enum.reject(headers, fn {k, _} -> k == "content-length" end)
|
||||
|
||||
result =
|
||||
conn
|
||||
|> put_resp_headers(build_resp_headers(headers, opts))
|
||||
|> put_resp_headers(headers)
|
||||
|> send_chunked(status)
|
||||
|> chunk_reply(client, opts)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user