diff options
author | lain <lain@soykaf.club> | 2021-03-03 15:07:50 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2021-03-03 15:07:50 +0000 |
commit | 13aa98d6899ba1e4a37fa1fd3ddb1ac35ea6e136 (patch) | |
tree | 6cb37e5d84ff967d7537d0c6a0ec817399bc24b6 /lib | |
parent | 49afbcda5f47ce48565ae07da3db990ad6cbb767 (diff) | |
parent | 10f402af6d0f088aa6ad8a3f26b5e226a2287634 (diff) | |
download | pleroma-13aa98d6899ba1e4a37fa1fd3ddb1ac35ea6e136.tar.gz pleroma-13aa98d6899ba1e4a37fa1fd3ddb1ac35ea6e136.zip |
Merge branch 'mergeback/2.3.0' into 'develop'
Mergeback/2.3.0
See merge request pleroma/pleroma!3360
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/reverse_proxy.ex | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/lib/pleroma/reverse_proxy.ex b/lib/pleroma/reverse_proxy.ex index 466906f03..406f7e2b8 100644 --- a/lib/pleroma/reverse_proxy.ex +++ b/lib/pleroma/reverse_proxy.ex @@ -4,7 +4,7 @@ defmodule Pleroma.ReverseProxy do @range_headers ~w(range if-range) - @keep_req_headers ~w(accept user-agent accept-encoding cache-control if-modified-since) ++ + @keep_req_headers ~w(accept accept-encoding cache-control if-modified-since) ++ ~w(if-unmodified-since if-none-match) ++ @range_headers @resp_cache_headers ~w(etag date last-modified) @keep_resp_headers @resp_cache_headers ++ @@ -57,9 +57,6 @@ defmodule Pleroma.ReverseProxy do * `false` will add `content-disposition: attachment` to any request, * a list of whitelisted content types - * `keep_user_agent` will forward the client's user-agent to the upstream. This may be useful if the upstream is - doing content transformation (encoding, …) depending on the request. - * `req_headers`, `resp_headers` additional headers. * `http`: options for [hackney](https://github.com/benoitc/hackney) or [gun](https://github.com/ninenines/gun). @@ -84,8 +81,7 @@ defmodule Pleroma.ReverseProxy do import Plug.Conn @type option() :: - {:keep_user_agent, boolean} - | {:max_read_duration, :timer.time() | :infinity} + {:max_read_duration, :timer.time() | :infinity} | {:max_body_length, non_neg_integer() | :infinity} | {:failed_request_ttl, :timer.time() | :infinity} | {:http, []} @@ -291,17 +287,13 @@ defmodule Pleroma.ReverseProxy do end end - defp build_req_user_agent_header(headers, opts) do - if Keyword.get(opts, :keep_user_agent, false) do - List.keystore( - headers, - "user-agent", - 0, - {"user-agent", Pleroma.Application.user_agent()} - ) - else - headers - end + defp build_req_user_agent_header(headers, _opts) do + List.keystore( + headers, + "user-agent", + 0, + {"user-agent", Pleroma.Application.user_agent()} + ) end defp build_resp_headers(headers, opts) do |