-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Labels
aws:ec2Amazon Elastic Compute CloudAmazon Elastic Compute Cloudaws:s3Amazon Simple Storage ServiceAmazon Simple Storage Servicestatus: response requiredWaiting for a response from the reporterWaiting for a response from the reportertype: bugBug reportBug report
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
Localstack gets an exception when client performs downloading a S3 object from a presigned url on AWS EC2
Expected Behavior
Localstack serves successfully when client performs downloading a S3 object from a presigned url on AWS EC2 regardless the domain of EC2 provides
How are you starting LocalStack?
With a docker-compose file
Steps To Reproduce
How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)
- Using docker compose to start localstack
- There are 2 environments: local and aws ec2
Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
- An object is put to aws s3 bucket, able to list it successfully via aws s3 ls command
- When the backend (Golang) returns the presigned url for frontend (React), only local environment is able to access via localhost, example via curl commands below
curl 'http://localhost:4566/2023-02-25/2023-02-25_14-42-33_Platform-Engineering-1676904192573.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=***' \
-H 'Accept: */*' \
-H 'Accept-Language: en-US,en;q=0.9' \
-H 'Connection: keep-alive' \
-H 'Origin: http://localhost:4006' \
-H 'Referer: http://localhost:4006/' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36' \
--compressed \
--insecure
- The localstack is consistently setup in aws ec2 machine, but it is unable to download via presigned url that ec2 returns (X-X-X-X is the public ip of ec2)
curl 'http://ec2-X-X-X-X.ap-southeast-1.compute.amazonaws.com:4566/2023-02-25/2023-02-25_15-20-25_Platform-Engineering-1676904192573.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=***' \
-H 'Accept: */*' \
-H 'Accept-Language: en-US,en;q=0.9' \
-H 'Connection: keep-alive' \
-H 'Origin: http://ec2-X-X-X-X.ap-southeast-1.compute.amazonaws.com:4006' \
-H 'Referer: http://ec2-X-X-X-X.ap-southeast-1.compute.amazonaws.com:4006/' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36' \
--compressed \
--insecure --output -
<?xml version='1.0' encoding='utf-8'?>
<Response xmlns="http://ec2.amazonaws.com/doc/2016-11-15"><Errors><Error><Code>InternalError</Code><Message>exception while calling ec2 with unknown operation: Operation detection failed. Missing Action in request for query-protocol service ServiceModel(ec2).</Message></Error></Errors><RequestID>H80UFPJBAW3NKHCIC6F6E5ILOK1DCRTQ9Z87M0VLFTUJI4B0YMSD</RequestID></Response>
- If we change the full domain of aws ec2 to the exact ip or using nip.io (nip-1-1-1-1.nip.io resolve to IP 1.1.1.1 for example), it works 🤔
curl 'http://X.X.X.X:4566/spenmo/ocr/drag-and-drop/2023-02-25/2023-02-25_15-20-25_Platform-Engineering-1676904192573.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=***' \
-H 'Accept: */*' \
-H 'Accept-Language: en-US,en;q=0.9' \
-H 'Connection: keep-alive' \
-H 'Origin: http://ec2-X-X-X-X.ap-southeast-1.compute.amazonaws.com:4006' \
-H 'Referer: http://ec2-X-X-X-X.ap-southeast-1.compute.amazonaws.com:4006/' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36' \
--compressed \
--insecure --output -
curl 'http://nip-X-X-X-X.nip.io:4566/spenmo/ocr/drag-and-drop/2023-02-25/2023-02-25_15-20-25_Platform-Engineering-1676904192573.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=****' \
-H 'Accept: */*' \
-H 'Accept-Language: en-US,en;q=0.9' \
-H 'Connection: keep-alive' \
-H 'Origin: http://ec2-X-X-X-X.ap-southeast-1.compute.amazonaws.com:4006' \
-H 'Referer: http://ec2-X-X-X-X.ap-southeast-1.compute.amazonaws.com:4006/' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36' \
--compressed \
--insecure --output -
Environment
- OS: MacOS 13.2.1 and AWS EC2
- LocalStack: 1.4.0Anything else?
No response
azarudeena
Metadata
Metadata
Assignees
Labels
aws:ec2Amazon Elastic Compute CloudAmazon Elastic Compute Cloudaws:s3Amazon Simple Storage ServiceAmazon Simple Storage Servicestatus: response requiredWaiting for a response from the reporterWaiting for a response from the reportertype: bugBug reportBug report