Closed
Description
I tied to put object on S3 with CacheControl header has ',' character and got "The request signature we calculated does not match the signature you provided" exception.
Expected Behavior
It should be possible to put object on s3 with header CacheControl = "max-age=3600,s-maxage=60"
Current Behavior
If user puts value with "," character (for example: max-age=7200,s-maxage=60) to PutObjectRequest.Headers.CacheControl, unhandled exception appears:
Amazon.S3.AmazonS3Exception: The request signature we calculated does not match the signature you provided. Check your key and signing method
Steps to Reproduce (for bugs)
Here is my sample:
var s3 = new AmazonS3Client();
var request = new PutObjectRequest {
BucketName = "my-bucket",
Key = "my-object.txt",
CannedACL = S3CannedACL.PublicRead,
ContentBody = "my body",
Headers = {
CacheControl = "max-age=7200,s-maxage=60"
}
};
s3.PutObjectAsync(request).GetAwaiter().GetResult();
Context
I have S3 bucket. On the top of this bucket I have CloudFront and I want to control cloudfront cache behavior with a help of two http headers max-age and s-maxage
Your Environment
- AWSSDK.S3 version used: 3.3.104.31
- Operating System and version: Windows 10
- Visual Studio version: 2017
- Targeted .NET platform: netcoreapp2.1
.NET Core Info
- Output of
dotnet --info
:
.NET Core SDK (reflecting any global.json):
Version: 2.2.104
Commit: 73f036d4ac
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.2.104\
Host (useful for support):
Version: 2.2.2
Commit: a4fd7b2c84
.NET Core SDKs installed:
2.1.504 [C:\Program Files\dotnet\sdk]
2.1.505 [C:\Program Files\dotnet\sdk]
2.1.509 [C:\Program Files\dotnet\sdk]
2.2.104 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
- Contents of project.json/project.csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AWSSDK.S3" Version="3.3.104.31" />
</ItemGroup>
</Project>