Skip to content

HTTP requests fail with 308 redirects from Safe Transaction Service API #25

@Khrafts

Description

@Khrafts

Description

When using the Safe library to propose transactions via the Safe Transaction Service API, requests fail with a ProposeTransactionFailed(308, ...) error containing an HTML redirect page.

Root Cause

The underlying solidity-http library uses curl without the -L flag, so HTTP redirects are not followed. The Safe Transaction Service API returns 308 Permanent Redirect responses (likely for URL normalization), which causes the request to fail.

Error Output

ProposeTransactionFailed(308, "\r308 Permanent Redirect\r\r308 Permanent Redirect\rnginx\r\r")

Fix

A fix has been submitted to the solidity-http library:
Recon-Fuzz/solidity-http#1

Once merged, updating the solidity-http dependency will resolve this issue.

Workaround

Manually patch lib/solidity-http/src/HTTP.sol line 150 to add redirect support by adding the -L flag:

- string memory scriptStart = 'response=$(curl -s -w "\\n%{http_code}" ';
+ string memory scriptStart = 'response=$(curl -sL -w "\\n%{http_code}" ';

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions