logo
down
shadow

How can I set the Cache-Control when using Write-S3Object?


How can I set the Cache-Control when using Write-S3Object?

Content Index :

How can I set the Cache-Control when using Write-S3Object?
Tag : powershell , By : Alpinfish
Date : November 23 2020, 01:01 AM

With these it helps I set up some test folders locally and on S3 and can replicate this issue exactly.
After some digging/experimenting... it relates to the CannedACLName parameter. The files upload successfully when removing that parameter.
Write-S3Object 
   -BucketName 'user-ab-staging' 
   -KeyPrefix 'content/css' 
   -Folder 'content/css' 
   -SearchPattern '*.css' 
   -Metadata @{"Cache-Control" = "Value"}
   -CannedACLName public-read

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

why and where we have to write header cache control?


Tag : php , By : joshski
Date : March 29 2020, 07:55 AM
I hope this helps you .
where we have to write these lines of codes? on the page where we do databse dealing or just any php pages?

Anyone else experiencing aws-s3 timeout problems when looking for nonexistant keys? S3Object.exist? and S3Object.request


Tag : ruby-on-rails , By : TRobison
Date : March 29 2020, 07:55 AM
help you fix your problem aws-s3 gem does not set the timeout to reasonable values
You can do it by monkeypatching its create_connection method
# Sets the timeouts to appropriate values for S3
module AWS
  module S3
    class Connection #:nodoc:
      private
      def create_connection_with_timeout_settings
        http = create_connection_without_timeout_settings
        http.open_timeout = 1
        http.read_timeout = 5
        http
      end
      alias_method_chain :create_connection, :timeout_settings
    end
  end
end

How can I cache to 1 minute with S3 and CloudFront and Write-S3Object


Tag : amazon-web-services , By : Lunis Neko
Date : March 29 2020, 07:55 AM
Does that help Here's a nice primer for the Cache-Control header. You need the header to look like this*:
Cache-Control: public,max-age=60
 -HeaderCollection @{"Cache-Control" = "public,max-age=60"}
Cache-Control: no-cache
Cache-Control: max-age=60,must-revalidate

How can I set cache-control using Write-S3Object with S3 and Cloudfront Distributions?


Tag : amazon-s3 , By : jsmb
Date : March 29 2020, 07:55 AM
wish help you to fix your issue You need to use the -Metadata parameter in your query, changing your -HeaderCollection @{"Cache-Control" = "public,max-age=120"} parameter to -Metadata @{"Cache-Control" = "public,max-age=120"} works fine, and can be seen in AWS web console.
Here is working snippet
 Write-S3Object -BucketName myBucket -file "test.json" -Metadata
 @{"Cache-Control" = "public,max-age=120"}
PS C:\Users\DanielH1> Get-AWSPowerShellVersion

AWS Tools for Windows PowerShell
Version 3.1.5.1
Copyright 2012-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Amazon Web Services SDK for .NET
Version 3.1.0.2
Copyright 2009-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Release notes: https://aws.amazon.com/releasenotes/PowerShell

This software includes third party software subject to the following copyrights:
- Logging from log4net, Apache License
[http://logging.apache.org/log4net/license.html]

Is it safe to return an ResponseEntity<InputStreamResource> that wraps S3Object.getObjectContent() in REST control


Tag : java , By : shenol
Date : March 29 2020, 07:55 AM
hope this fix your issue After some research I found the answer, that should be applicable to my question.
Tl;dr version: Spring MVC handles the closing of the given input stream, so my approach described above should be safe.
Related Posts Related QUESTIONS :
  • I have a folder that contains multiple folders which contain images. I want to filter the images based on dimensions
  • Function not working even though variable looks fine
  • How to specify multiple files in $sourcePath
  • Deleting a specific tag in xml file
  • Suppressing called function/cmdlet's WhatIf output, when that function has no WhatIf parameter
  • Import CSV File to a new Excel Worksheet within an existing Excel Workbook
  • Start-Service cmdlet: get underlying error in case of failure
  • What would the opposite if this office 365 powershell command?
  • How to install the WASP in powershell?
  • change powershell command color
  • How to list all installed, runnable cmdlets in powershell?
  • PowerShell index value of PSObject
  • Powershell Foreach-Object behaves abnormaly on null values
  • My code will not write "No files to process"
  • Get certificates information using powershell
  • How to uninstall dell support assist with powershell?
  • EF6 Add-Migration in PowerShell, outside Visual Studio
  • Not able to rename button base on value
  • Description property dont give back result
  • Using powershell script with different parameters
  • How to get the current script to read off computer names off a txt file located on c:\
  • Powershell check if drive letter exists and if so remove
  • Powershell script to return search results from a list of keywords
  • PowerShell copy fails without warning
  • Get Windows Last Reboot Timestamp?
  • In PowerShell how to capture error, warning, write-host output into a single file?
  • Set-Acl only on on files containing certain keyword
  • Weird Coalesce Behavior
  • Search for a word within a file that has a specific modified date
  • How to fetch first column from given powershell array?
  • How to add text to a file foreach column using PowerShell?
  • How to share data between cmdlets in a module?
  • How to exclude some column in CSV using Powershell?
  • ARM Template for Redis Cache failing to deploy
  • Copy folders that match names to other sub folder of matching directory
  • How to set parameters for SaveAs() dialog in Word.Application?
  • Attempting to Filter out All .p12 AND .pfx files from a given Directory
  • Powershell FTP Script String Concatenation
  • How to GET variables used in a specific BUILD in Azure Devops / TFS via api
  • Cleaning up DistributionGroup in PowerShell
  • PowerShell method Contains not working as expected
  • Feeding Get-ChildItem path info from an array - Illegal characters
  • Script argument as private scope variable
  • PowerShell Hashtable to JSON without Quotes
  • How to set as variable csv column using powershell?
  • Move flag from one script to another in PowerShell
  • Sort-Object problem (one MAC address and two IP addresses)
  • concatenate columnar output in PowerShell
  • When a list of objects is retruned from Get-EventLog that itself contains an array of strings, how do I access the array
  • Passing down a variable to function creates an array
  • Get-Date cannot convert null to type "System.Datetime"
  • I want run PowerShell commands using administrator with normal PowerShell user
  • How to using loop to find a file and remove it using PowerShell?
  • PowerShell Get-ChildItem on folder that does not exist behaves different with the -recurse flag
  • How to do looping for checking an existing folder with PowerShell?
  • Having trouble outputting to a CSV file. I know the output is a curly brackets "collection", but I'm stumped
  • How to replace last part of a string dynamically?
  • Checking to see if PowerShell Command worked, Crap Error
  • (Date).ToString does not use specified delimiter
  • Loop through multiple array in powershell
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com