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

Connections using "localhost" to Azurite container don't work #2538

Open
craxal opened this issue Mar 11, 2025 · 8 comments
Open

Connections using "localhost" to Azurite container don't work #2538

craxal opened this issue Mar 11, 2025 · 8 comments
Assignees
Labels
question Further information is requested

Comments

@craxal
Copy link
Member

craxal commented Mar 11, 2025

I have an Azurite Docker container configured to use the default ports. When using Storage Explorer, if I create a connection to the Azurite Docker container using "localhost", I sometimes get authentication errors when trying to download multiple blobs using. But when I create a connection using "127.0.0.1", I don't have problems.

@blueww
Copy link
Member

blueww commented Mar 12, 2025

Hi @craxal ,

Would you please get the Azurite debug log for the success/fail request, then we can look into it?
And please also share:

  1. Azurite version,
  2. The command to start Azurite
  3. The connection (hide credential)
  4. Can you repro this issue with other client tool/SDK?

@craxal
Copy link
Member Author

craxal commented Mar 12, 2025

I should probably clarify that some types of requests don't seem to work, whereas others do. We are able to list blobs, for example, but attempts to download all blobs from a specific folder/prefix don't work. Switching from "localhost" to "127.0.0.1" resolves the issue.

  1. 10.28.0
  2. docker run -p 10000:10000 -p 10001:10001 -p 10002:10002 mcr.microsoft.com/azure-storage/azurite:latest
  3. AccountKey=REDACTED;AccountName=devstoreaccount1;BlobEndpoint=http://localhost:10000/devstoreaccount1;QueueEndpoint=http://localhost:10001/devstoreaccount1;TableEndpoint=http://localhost:10002/devstoreaccount1;
  4. As follows:
2025/03/12 17:19:55 AzcopyVersion 10.28.0 2025/03/12 17:19:55 OS-Environment windows 2025/03/12 17:19:55 OS-Architecture amd64 2025/03/12 17:19:55 Log times are in UTC. Local time is 12 Mar 2025 10:19:55 2025/03/12 17:19:55 ==> REQUEST/RESPONSE (Try=1/3.0146ms, OpTime=29.5508ms) -- RESPONSE STATUS CODE ERROR HEAD http://localhost:10000/devstoreaccount1/test01%2F?se=2025-04-11T17%3A19%3A54Z&sig=-REDACTED-&sp=rl&sr=c&sv=2018-03-28 Accept: application/xml User-Agent: Microsoft/Azure/Storage/ azsdk-go-azblob/v1.4.0 (go1.22.7; Windows_NT) X-Ms-Client-Request-Id: fc79560f-4af4-4ce9-6acf-2a6e5e35fe38 x-ms-version: 2019-07-07 -------------------------------------------------------------------------------- RESPONSE Status: 400 Bad Request Connection: keep-alive Date: Wed, 12 Mar 2025 17:19:55 GMT Keep-Alive: timeout=5 Server: Azurite-Blob/3.29.0 Response Details:

2025/03/12 17:19:55 ==> REQUEST/RESPONSE (Try=1/1.5884ms, OpTime=1.5884ms) -- RESPONSE STATUS CODE ERROR
HEAD http://localhost:10000/devstoreaccount1/test01?se=2025-04-11T17%3A19%3A54Z&sig=-REDACTED-&sp=rl&sr=c&sv=2018-03-28
Accept: application/xml
User-Agent: Microsoft/Azure/Storage/ azsdk-go-azblob/v1.4.0 (go1.22.7; Windows_NT)
X-Ms-Client-Request-Id: d32de2e9-188c-48ee-7fd1-ad7d6e4c33e4
x-ms-version: 2019-07-07

RESPONSE Status: 400 Bad Request
Connection: keep-alive
Date: Wed, 12 Mar 2025 17:19:55 GMT
Keep-Alive: timeout=5
Server: Azurite-Blob/3.29.0
Response Details:

2025/03/12 17:19:55 ==> REQUEST/RESPONSE (Try=1/2.5592ms, OpTime=2.5592ms) -- RESPONSE STATUS CODE ERROR
GET http://localhost:10000/devstoreaccount1?comp=list&delimiter=%2F&include=metadata&prefix=test01%2F&restype=container&se=2025-04-11T17%3A19%3A54Z&sig=-REDACTED-&sp=rl&sr=c&sv=2018-03-28
Accept: application/xml
User-Agent: Microsoft/Azure/Storage/ azsdk-go-azblob/v1.4.0 (go1.22.7; Windows_NT)
X-Ms-Client-Request-Id: b68cdf6e-7391-46ad-7cb7-5f1e1ab7f4f9
x-ms-version: 2019-07-07

RESPONSE Status: 403 Server failed to authenticate the request. Make sure the value of the Authorization header is formed correctly including the signature.
Connection: keep-alive
Content-Type: application/xml
Date: Wed, 12 Mar 2025 17:19:55 GMT
Keep-Alive: timeout=5
Server: Azurite-Blob/3.29.0
X-Ms-Error-Code: AuthorizationFailure
X-Ms-Request-Id: ab641040-161b-4c46-be11-87fbf275537d
Response Details: AuthorizationFailure Server failed to authenticate the request. Make sure the value of the Authorization header is formed correctly including the signature.

2025/03/12 17:19:55 Closing Log

Transfer of 'devstoreaccount1/test01/' to 'C:\Users\cralvord\Downloads\test01' failed: 0 items transferred, error: failed to perform copy command due to error: cannot start job due to error: cannot list files due to reason GET http://localhost:10000/devstoreaccount1
--------------------------------------------------------------------------------
RESPONSE 403: 403 Server failed to authenticate the request. Make sure the value of the Authorization header is formed correctly including the signature.
ERROR CODE: AuthorizationFailure
--------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Error>
<Code>AuthorizationFailure</Code>
<Message>Server failed to authenticate the request. Make sure the value of the Authorization header is formed correctly including the signature.
RequestId:ab641040-161b-4c46-be11-87fbf275537d
Time:2025-03-12T17:19:55.415Z</Message>
</Error>
--------------------------------------------------------------------------------
.
(used SAS, discovery not completed)
Started at: 12 Mar 2025 10:19, Duration: 2 seconds

@blueww
Copy link
Member

blueww commented Mar 13, 2025

@craxal

Thanks for the update!
However, Azurite doesn't has 10.28.0 version, the latest is 3.34.0.

The debug log you share is not Azurite debug log, so we still can't see your detail request , and how Azurite handle the request and send 403 back. Could you please share the Azurite debug log get with "--debug" parameter?

@craxal
Copy link
Member Author

craxal commented Mar 13, 2025

You're right, sorry about that.

Where would the logs be in an Azurite container?

Version in use is: 3.29.0

Console output:

2025-03-13 14:30:37 Azurite Blob service is starting at http://0.0.0.0:10000
2025-03-13 14:30:37 Azurite Blob service is successfully listening at http://0.0.0.0:10000
2025-03-13 14:30:37 Azurite Queue service is starting at http://0.0.0.0:10001
2025-03-13 14:30:37 Azurite Queue service is successfully listening at http://0.0.0.0:10001
2025-03-13 14:30:37 Azurite Table service is starting at http://0.0.0.0:10002
2025-03-13 14:30:37 Azurite Table service is successfully listening at http://0.0.0.0:10002
2025-03-13 14:30:59 172.17.0.1 - - [13/Mar/2025:21:30:59 +0000] "GET /test01?comp=properties&restype=account HTTP/1.1" 200 -
2025-03-13 14:31:01 172.17.0.1 - - [13/Mar/2025:21:31:01 +0000] "GET /test01?comp=list&include=metadata HTTP/1.1" 200 -
2025-03-13 14:31:01 172.17.0.1 - - [13/Mar/2025:21:31:01 +0000] "GET /test01/%24logs?restype=container HTTP/1.1" 404 -
2025-03-13 14:31:01 172.17.0.1 - - [13/Mar/2025:21:31:01 +0000] "GET /test01/%24blobchangefeed?restype=container HTTP/1.1" 404 -
2025-03-13 14:31:01 172.17.0.1 - - [13/Mar/2025:21:31:01 +0000] "GET /test01/?comp=list&include=metadata&timeout=30 HTTP/1.1" 400 -
2025-03-13 14:31:02 172.17.0.1 - - [13/Mar/2025:21:31:02 +0000] "GET /test01?comp=list&include=metadata HTTP/1.1" 200 -
2025-03-13 14:31:02 172.17.0.1 - - [13/Mar/2025:21:31:02 +0000] "GET /test01/%24logs?restype=container HTTP/1.1" 404 -
2025-03-13 14:31:02 172.17.0.1 - - [13/Mar/2025:21:31:02 +0000] "GET /test01/%24blobchangefeed?restype=container HTTP/1.1" 404 -
2025-03-13 14:31:02 172.17.0.1 - - [13/Mar/2025:21:31:02 +0000] "GET /test01/test01?restype=container HTTP/1.1" 200 -
2025-03-13 14:31:03 172.17.0.1 - - [13/Mar/2025:21:31:03 +0000] "GET /test01?restype=service&comp=properties HTTP/1.1" 200 -
2025-03-13 14:31:04 172.17.0.1 - - [13/Mar/2025:21:31:04 +0000] "GET /test01/test01?comp=properties&restype=account HTTP/1.1" 200 -
2025-03-13 14:31:04 172.17.0.1 - - [13/Mar/2025:21:31:04 +0000] "GET /test01/test01?comp=list&maxresults=5000&restype=container&include=metadata&delimiter=%2F HTTP/1.1" 200 -
2025-03-13 14:31:11 172.17.0.1 - - [13/Mar/2025:21:31:11 +0000] "HEAD /test01/test01%2F?se=2025-04-12T21%3A31%3A10Z&sig=7YEIX85xaLktAao06GWKpRfTov3iBG3UVhWmbxZiqjA%3D&sp=rl&sr=c&sv=2018-03-28 HTTP/1.1" 400 -
2025-03-13 14:31:11 172.17.0.1 - - [13/Mar/2025:21:31:11 +0000] "HEAD /test01/test01?se=2025-04-12T21%3A31%3A10Z&sig=7YEIX85xaLktAao06GWKpRfTov3iBG3UVhWmbxZiqjA%3D&sp=rl&sr=c&sv=2018-03-28 HTTP/1.1" 400 -
2025-03-13 14:31:11 172.17.0.1 - - [13/Mar/2025:21:31:11 +0000] "GET /test01?comp=list&delimiter=%2F&include=metadata&prefix=test01%2F&restype=container&se=2025-04-12T21%3A31%3A10Z&sig=7YEIX85xaLktAao06GWKpRfTov3iBG3UVhWmbxZiqjA%3D&sp=rl&sr=c&sv=2018-03-28 HTTP/1.1" 403 -

@craxal
Copy link
Member Author

craxal commented Mar 13, 2025

I updated my image so that the Azurite version is now 3.34.0, but the issue remains.

@blueww
Copy link
Member

blueww commented Mar 14, 2025

Hi @craxal ,

Thanks for the sharing!
However, this is not Azurite debug log. Azurite debug log is get by start Azurite with "--debug" parameter.

@craxal
Copy link
Member Author

craxal commented Mar 14, 2025

@blueww I don't have direct control over Azurite starting, because I'm working with a Docker container. How do I pass the --debug flag to Azurite within the container?

@blueww
Copy link
Member

blueww commented Mar 17, 2025

Hi @craxal,

For run Azurite in docker, you get debug log by start Azurite with :

  1. "-v c:/azurite:/workspace" map host machine folder c:/azurite as Azurite's workspace location. (you can use other host machine folder )
  2. "-d /workspace/debug.log", generate debug log in workspace location, then you will find it in host path c:/azurite/debug.log

Following is the sample commandline:

docker run -p 10000:10000 -p 10001:10001 -p 10002:10002 -v c:/azurite:/workspace mcr.microsoft.com/azure-storage/azurite azurite --blobHost 0.0.0.0 --queueHost 0.0.0.0 --tableHost 0.0.0.0 -d /workspace/debug.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants