amberframework / amber

A Crystal web framework that makes building applications fast, simple, and enjoyable. Get started with quick prototyping, less bugs, and blazing fast performance.
https://amberframework.org
MIT License
2.57k stars 206 forks source link

1221 configurable static response headers #1233

Closed midhunkrishna closed 3 years ago

midhunkrishna commented 3 years ago

Ability to configure response headers from .yml file with the following configuration,

public_file_server:
  headers:
    "Cache-Control": "private, max-age=7200"

Description of the Change

When files are served by the static file server, via pipes/static.cr, and does not expose a way to modify the hard coded Cache-Control headers

Alternate Designs

This enhancement is similar to the static file middle-ware headers configuration of Rails. Original PR

Benefits

Ability to modify response headers for files served by static pipe.

Possible Drawbacks

Since this PR is an enhancement to the existing functionality, no changes are introduced to the behavior of the framework.

midhunkrishna commented 3 years ago

@eliasjpr This should fix #1221 . Can you take a look and add your thoughts?