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

Make Cache control configuration optional #159

Open
badri opened this issue Aug 3, 2023 · 0 comments
Open

Make Cache control configuration optional #159

badri opened this issue Aug 3, 2023 · 0 comments

Comments

@badri
Copy link

badri commented Aug 3, 2023

The default nginx.conf contains the following configuration

      # Some basic cache-control for static files to be sent to the browser
        location ~* \.(?:ico|css|js|gif|jpeg|jpg|png)$ {
            expires         max;
            add_header      Pragma public;
            add_header      Cache-Control "public, must-revalidate, proxy-revalidate";
        }

which doesn't work with frameworks like Drupal. In some scenarios, example: the framework aggregates CSS and JS files, creates thumbnails of uploaded images.
These aggregate CSS/JS files, generated thumbnails etc. don't get created in the first place as the above configuration prevents nginx from doing so.

Describe the Enhancement

If this section is removed from the nginx configuration, the above scenarios work and the files do get created.

Possible Solution

  1. This section could be toggled based on a build-time env variable, very similar to BP_PHP_ENABLE_HTTPS_REDIRECT.
    Something like BP_PHP_ENABLE_CACHE_CONTROL whose default value is true.

  2. Another simpler solution is to remove this section entirely, so that the buildpack users can add to their overridden nginx configs if they need it.

I've tested both approaches locally and they seem to work. Happy to raise a PR on whatever route we agree upon. I'm slightly biased towards the 2nd approach.

Motivation

Drupal is a major PHP framework and making this change will make Paketo work with Drupal 8,9 and 10. This is also an opportunity to make nginx configuration more barebones.

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

1 participant