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

getAuthenticatedURL with HTTPS? #10

Closed
Ben-CA opened this issue May 30, 2020 · 3 comments
Closed

getAuthenticatedURL with HTTPS? #10

Ben-CA opened this issue May 30, 2020 · 3 comments

Comments

@Ben-CA
Copy link

Ben-CA commented May 30, 2020

Is there a way for the getAuthenticatedURL to provide an HTTPS link to the file on S3 so the data is encrypted with SSL?

Like:
https://s3-us-east-1.amazonaws.com/documents.mybucket/file.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=blahblahblah

Instead of:
http://s3-us-east-1.amazonaws.com/documents.mybucket/file.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=blahblahblah

(The HTTPS link works, but the function returns a non-HTTPS version.)

(I suppose I could do a string replace and change it, but was curious if there's a built-in parameter for SSL.)

@ryandemmer
Copy link
Contributor

ryandemmer commented May 30, 2020

$url = $connector->getAuthenticatedURL('mybucket', 'path/to/file', 3600, true);

The value 3600 is the lifetime of the url in seconds, in this case 60 minutes.

The boolean value at the end makes it an https url.

@Ben-CA
Copy link
Author

Ben-CA commented May 30, 2020

Excellent - thanks Ryan!

@Ben-CA
Copy link
Author

Ben-CA commented May 30, 2020

Do you know if you can pass headers as well? So for instance if you want the user's browser to download the file vs. displaying it.

Something like:

  $headers = array("response-content-disposition"=>"attachment");
  $preSignedURL = $connector->getAuthenticatedURL($document_bucket, $file_with_path, 60, true, true, $headers);

(But that doesn't seem to work for me)

Update: I looked at the function code, and see that that's all the parameters provided. So doesn't appear to be a way to pass headers using this function.

@Ben-CA Ben-CA closed this as completed May 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants