Skip to content

Conversation

@speeddragon
Copy link

@speeddragon speeddragon commented Nov 18, 2025

The goal for this functionality is to provide the gun HTTP client with the following redirect functionality, we might in some requests.

This is disabled by default and can be enabled by setting follow_redirects to true.

routes = [#{
    <<"template">> => <<"/raw">>,
    <<"node">> =>
        #{
            <<"prefix">> => <<"https://arweave.net">>,
            <<"opts">> => #{ http_client => gun, protocol => http2, <<"follow_redirect">> => true}
        }
}]

or via a config flat file:

routes/1/node/opts/ao-types: follow_redirect=atom
routes/1/node/opts/follow_redirect: true

For testing, I used the mock server in this PR.

Actions

  • To be tested with the main use case.

Comment on lines +215 to +220
NewOpts = maps:update_with(
current_redirects,
fun (Value) -> Value + 1 end,
1,
Opts
),
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is the right way to keep track of how many redirects we had, but to do it in another way, I would have to change the code more deeply.

@speeddragon speeddragon marked this pull request as draft November 18, 2025 14:25
@noahlevenson
Copy link

Not sure if relevant, but we may have attempted similar functionality here: #477

(That PR, #477, was merged into #481)

@speeddragon
Copy link
Author

Thanks! After reviewing the code, it appears to be better implemented than this PR. I will close this (but keep the branch for now, in case I need this code for testing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants