[GH-ISSUE #153] s3fs statically sets host header to s3.amazonaws.com in some cases #90

Closed
opened 2026-03-04 01:41:56 +03:00 by kerem · 4 comments
Owner

Originally created by @rvdm on GitHub (Mar 19, 2015).
Original GitHub issue: https://github.com/s3fs-fuse/s3fs-fuse/issues/153

Hi,

When using a non-Amazon hosted S3 bucket, s3fs adds a static host: header to its requests. This results in HTTP 400 errors from non-AWS S3 buckets, breaking s3fs on top of alternative S3 implementations.

From src/curl.cpp:

requestHeaders = curl_slist_sort_insert(requestHeaders, "host", string(bucket + ".s3.amazonaws.com").c_str());
Originally created by @rvdm on GitHub (Mar 19, 2015). Original GitHub issue: https://github.com/s3fs-fuse/s3fs-fuse/issues/153 Hi, When using a non-Amazon hosted S3 bucket, s3fs adds a static host: header to its requests. This results in HTTP 400 errors from non-AWS S3 buckets, breaking s3fs on top of alternative S3 implementations. From src/curl.cpp: ``` c++ requestHeaders = curl_slist_sort_insert(requestHeaders, "host", string(bucket + ".s3.amazonaws.com").c_str()); ```
kerem closed this issue 2026-03-04 01:41:56 +03:00
Author
Owner

@gaul commented on GitHub (Mar 19, 2015):

Note that this is only done for V4 authentication.

<!-- gh-comment-id:83780251 --> @gaul commented on GitHub (Mar 19, 2015): Note that this is only done for V4 authentication.
Author
Owner

@rvdm commented on GitHub (Mar 20, 2015):

Correct, but the client will try V4 first (unless it's disabled as a mount option). Anyway, hardcoding hostnames is never a good idea :)

I would love to write a patch, but my cpp is too rusty for it. More clients have this issue, and for folks hosting an S3 endpoint it's not a very crazy idea to just add the Amazon hostname(s) to the virtualhost configuration - but it's a better idea to just clean it up :)

<!-- gh-comment-id:84079865 --> @rvdm commented on GitHub (Mar 20, 2015): Correct, but the client will try V4 first (unless it's disabled as a mount option). Anyway, hardcoding hostnames is never a good idea :) I would love to write a patch, but my cpp is too rusty for it. More clients have this issue, and for folks hosting an S3 endpoint it's not a very crazy idea to just add the Amazon hostname(s) to the virtualhost configuration - but it's a better idea to just clean it up :)
Author
Owner

@gaul commented on GitHub (Apr 11, 2015):

Fixed by #164.

<!-- gh-comment-id:91943585 --> @gaul commented on GitHub (Apr 11, 2015): Fixed by #164.
Author
Owner

@ggtakec commented on GitHub (Apr 11, 2015):

@andrewgaul @kahing
thank you.

<!-- gh-comment-id:91946656 --> @ggtakec commented on GitHub (Apr 11, 2015): @andrewgaul @kahing thank you.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/s3fs-fuse#90
No description provided.