Laravel: SignatureDoesNotMatch when uploading to Linode Object Storage

I am using Laravel S3 drive to upload files to Linode Object storage.

My config is like this:

FILESYSTEM_DRIVER=s3
AWS_ACCESS_KEY_ID=hidden-my-access-key-id
AWS_SECRET_ACCESS_KEY=hidden-my-access-key-secret
AWS_DEFAULT_REGION=ap-south-1
AWS_BUCKET=bucket-name
AWS_URL=https://bucket-name.ap-south-1.linodeobjects.com
AWS_ENDPOINT=ap-south-1.linodeobjects.com

But when my Laravel app tries to upload the file I get the below error:

[2021-08-23 14:03:25] local.ERROR: Error executing "PutObject" on "bucket-name/favicons/mZp2jj4CPXJcLqC2OtEtIPTIw5ysOQmNoJVtdHHf.ico"; AWS HTTP error: Client error: `PUT bucket-name/favicons/mZp2jj4CPXJcLqC2OtEtIPTIw5ysOQmNoJVtdHHf.ico` resulted in a `403 Forbidden` response:
<?xml version="1.0" encoding="UTF-8"?><Error><Code>SignatureDoesNotMatch</Code><RequestId>tx000000000000000c8d673-006123 (truncated...)
 SignatureDoesNotMatch (client):  - <?xml version="1.0" encoding="UTF-8"?><Error><Code>SignatureDoesNotMatch</Code><RequestId>tx000000000000000c8d673-006123aaad-3441a35-default</RequestId><HostId>3441a35-default-default</HostId></Error> 

Any idea what is broken?

2 Replies

Hi there,

I believe that you may have already resolved this issue, but just in case others in the future encounter similar errors, I was able to find a post on StackOverflow that offers more advice on how to go about integrating Linode's Object Storage with Laravel:

To summarize briefly:

You can accomplish this by installing a Composer Packages:

composer require league/flysystem-aws-s3-v3

Then you would add a new disk that uses the Laravel s3 driver under the configuration file config/filesystems.php:

'linode' => [
    'driver' => 's3',
    'key' => env('LINODE_KEY'),
    'secret' => env('LINODE_SECRET'),
    'endpoint' => env('LINODE_ENDPOINT'),
    'region' => env('LINODE_REGION'),
    'bucket' => env('LINODE_BUCKET'),
],

After this you want to define these environment variables in your project's .env file:

LINODE_KEY="ACCESSKEY"
LINODE_SECRET="ACCESSKEYSECRET"
LINODE_ENDPOINT="https://ap-south-1.linodeobjects.com"
LINODE_REGION="ap-south-1"
LINODE_BUCKET="your-bucket-name"

Note: you will want to include the quotation marks.

This should then give you access to your Linode Object Storage bucket via Laravel code:

disk('linode')

Also, your AWS_ENDPOINT config may need “https://“ at the beginning of it.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct