aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
461 stars 116 forks source link

Custom HTTP Pattern Not Matching Multiple Font Extensions in Amplify #3937

Closed Petri-Oosthuizen closed 5 months ago

Petri-Oosthuizen commented 5 months ago

Before opening, please confirm:

Amplify Hosting feature

Custom headers

Is your feature request related to a problem? Please describe:

Custom HTTP Pattern Not Matching Multiple Font Extensions in Amplify

Describe how you'd like this feature to work

Description:

I'm encountering an issue with custom headers in AWS Amplify when configuring them for multiple font file extensions using a pattern in the customHttp.yml file. While setting direct headers for individual extensions works, using a pattern with curly braces ({}) to match multiple extensions (e.g., **/*.{woff,woff2,ttf,otf,eot}) doesn't seem to apply the headers as expected.

Expected Behavior:

The custom header configuration should match files with any of the specified font extensions (woff, woff2, ttf, otf, eot) within the project directory structure and apply the defined headers (e.g., Cache-Control).

Actual Behavior:

The custom header is only applied to files with the exact extension listed first in the pattern (e.g., only .woff files in this case).

Steps to Reproduce:

  1. Create a new Amplify project or use an existing one.
  2. Add a customHttp.yml file to the project root directory.
  3. Include a pattern like this in the customHttp.yml file, replacing the value with your desired caching settings:
customHeaders:
  - pattern: "**/*.{woff,woff2,ttf,otf,eot}"
    headers:
      - key: Cache-Control
        value: max-age=86400, public  # Example caching for fonts
  1. Deploy the Amplify application.
  2. Verify by inspecting network requests in browser developer tools. The custom headers might not be applied to font files with extensions other than the first listed one (e.g., .woff2, .ttf, .otf, or .eot).
  3. Change headers to:
customHeaders:
  - pattern: "**/*.woff2"
    headers:
      - key: Cache-Control
        value: max-age=86400, public  # Example caching for fonts
  1. Deploy the Amplify application.
  2. Verify by inspecting network requests in browser developer tools. The custom headers will be applied to woff2 fonts.

Summary:

Questions:

Thank you for your assistance!

github-actions[bot] commented 5 months ago

This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you!

calavera commented 5 months ago

Thanks for opening this issue. Pattern ranges like the one in your example are supported now.

github-actions[bot] commented 5 months ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.

github-actions[bot] commented 5 months ago

This issue has been automatically locked.