Skip to content

GetPreSignedURLAsync returns real AWS URL instead of localstack one #50

@julealgon

Description

@julealgon

🐛 Bug Description

What happened?
After configuring localstack and injecting IAmazonS3 into my service, then calling GetPreSignedURLAsync on the client, the returned URL points to the real http://s3.us-east-1.amazonaws.com/test-bucket/... instead of my locally running http://localhost:64847/test-bucket/... container instance.

For whatever reason, this only seems to affect the presign method: all other operations interact with my emulator just fine.

I can also see that the client has proper proxy settings in it so it is picking up the configuration as expected:

  • ProxyPort: 64847
  • ProxyHost: "localhost"

What did you expect to happen?
I would expect that any presigned URLs generated with the adapted IAmazonS3 client from localstack would honor the same domain/port as the emulator instead of falling back to what seems to be the standard real AWS S3 base URL.

🔄 Steps to Reproduce

  1. Setup localstack
  2. Inject IAmazonS3
  3. Call GetPreSignedURLAsync
  4. Observe base URL points to real S3

Minimal code example:

var multipartResponse = await client.InitiateMultipartUploadAsync(
    new()
    {
        BucketName = "test-bucket",
        Key = "some-key",
    });

GetPreSignedUrlRequest presignedRequest = new()
{
    BucketName = "test-bucket",
    Key = "some-key",
    PartNumber = 1,
    UploadId = multipartResponse.UploadId,
    Verb = HttpVerb.PUT,
};

Uri presignedUrl = new(await client.GetPreSignedURLAsync(presignedRequest));

📋 Environment Information

LocalStack.Client Version:

  • v1.x (AWS SDK v3) - LTS Branch
  • v2.x (AWS SDK v4) - Current Branch
  • Version: 2.0.0

LocalStack Information:

  • LocalStack Version: 4.12.0
  • LocalStack Image: docker.io/localstack/localstack:4.12.0
  • LocalStack Services Used: S3

.NET Information:

  • .NET Version: .NET 10
  • Operating System: Windows 11
  • IDE/Editor: Visual Studio 2026

AWS SDK Information:

  • AWS SDK Version:
    • AWSSDK.S3 4.0.18.7
    • AWSSDK.Core 4.0.3.15
  • Services: S3

🔍 Additional Context

Configuration (Optional):

// Your LocalStack configuration (appsettings.json snippet)
{
  "LocalStack": {
    "EnableLocalStack": true
  }
}

Error Messages/Stack Traces:

Paste any error messages or stack traces here

Screenshots:
If applicable, add screenshots to help explain your problem.

Additional Information:
Add any other context about the problem here.

✅ Checklist

  • I have searched existing issues to ensure this is not a duplicate
  • I have provided all the requested information above
  • I have tested this with the latest version of LocalStack.Client
  • I have verified this issue occurs with LocalStack (not with real AWS services)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpotential bugSomething may not be working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions