这是indexloc提供的服务,不要输入任何密码
Skip to content

Signed URL does not respect host protocol when specified in StorageOptions #2870

@Ragge-dev

Description

@Ragge-dev

Hello!
I am having a very similar issue as in #1094, however it is just the protocol of the host which is not respected. In the example below I specify "http://example.com" but the signed url is towards "https://example.com". I don't know enough about this topic to know if https is required, for local development we are using http so I have to replace the protocol when signing urls locally towards a fake gcs server https://github.com/fsouza/fake-gcs-server. Let me know!

Environment details

  • Running on Ubuntu 24.04.1 LTS
  • Java version 21
  • com.google.cloud:libraries-bom, version = "26.52.0"

Code example

Storage storage = StorageOptions.getDefaultInstance().toBuilder().setHost("http://example.com/").build().getService();
BlobInfo blobInfo = BlobInfo.newBuilder(BlobId.of("bucket", "object")).build()
URL signedUrl =  storage.signUrl(
                                          blobInfo,
                                          1,
                                          TimeUnit.HOURS,
                                          SignUrlOption.signWith(credentials),
                                          SignUrlOption.withV4Signature());

Produces a signed url which starts with:
https://example.com/bucket/object?X-Goog-Algorithm=...

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: storageIssues related to the googleapis/java-storage API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions