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

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

Open
Ragge-dev opened this issue Jan 9, 2025 · 0 comments
Labels
api: storage Issues related to the googleapis/java-storage API.

Comments

@Ragge-dev
Copy link

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!

@product-auto-label product-auto-label bot added the api: storage Issues related to the googleapis/java-storage API. label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/java-storage API.
Projects
None yet
Development

No branches or pull requests

1 participant