Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3. Update virtual hosting URI pattern #2329

Closed
iRevive opened this issue May 24, 2020 · 2 comments
Closed

S3. Update virtual hosting URI pattern #2329

iRevive opened this issue May 24, 2020 · 2 comments
Labels
Milestone

Comments

@iRevive
Copy link
Contributor

iRevive commented May 24, 2020

Versions used

Alpakka version: 2.0.0, 1.1.2

Expected Behavior

I'm trying to access a bucket in the af-south-1 region.
Expected URI pattern: https://{bucketname}.s3.{Region}.amazonaws.com.

The current pattern works for certain regions, but unfortunately it does not work for the new one (af-south-1).

Official docs:

In practice, Amazon S3 interprets Host as meaning that most buckets 
are automatically accessible for limited types of requests at 
https://bucketname.s3.Region.amazonaws.com.
Some older Amazon S3 Regions support endpoints that contains 
a dash between S3 and the Region (for example, S3‐us-west-2), 
instead of a dot (for example, S3.us-west-2).

Source: https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html.

Actual Behavior

Alpakka uses the following pattern: https://{bucketname}.s3-{Region}.amazonaws.com.
Result URI: https://my-bucket.s3-af-south-1.amazonaws.com.

Exception:

Caused by: akka.stream.StreamTcpException: 
Tcp command [Connect(my-bucket.s3-af-south-1.amazonaws.com:443,None,List(),Some(10 seconds),true)] 
failed because of java.net.UnknownHostException: my-bucket.s3-af-south-1.amazonaws.com
@ennru ennru added the p:aws-s3 label May 29, 2020
@ennru
Copy link
Member

ennru commented May 29, 2020

Yes, AWS have cleaned up their special host names for different regions since Alpakka S3 was implemented initially, and I'm sure it can be simplified and improved. Please feel free to check out the code and see what needs to be done.

A more immediate solution might be to set the endpoint URL via settings:

# Custom endpoint url, used for alternate s3 implementations
# To enable virtual-host-style access with Alpakka S3 use the placeholder `{bucket}` in the URL
# eg. endpoint-url = "http://{bucket}.s3minio.alpakka:9000"
#
# endpoint-url = null

See even #1558

@ennru ennru added this to the 2.0.1 milestone Jun 9, 2020
@ennru
Copy link
Member

ennru commented Jun 9, 2020

Fixed with #2336

@ennru ennru closed this as completed Jun 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants