From 1746b9e2ddcc2e881129ac192257046b8624eaef Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Sat, 7 Nov 2020 13:19:56 +0000 Subject: [PATCH] Fix compatibility with ngx_mruby 1.18.4+ The `mruby_post_read_handler` directive should always have been outside the `location` block, however due to a bug in ngx_mruby the previous implementation happened to still work. In ngx_mruby 1.18.4 this silently stopped being the case: https://github.com/matsumotory/ngx_mruby/issues/210 And in ngx_mruby 1.18.5 this incorrect usage was turned into an error: https://github.com/matsumotory/ngx_mruby/pull/217 Moving `mruby_post_read_handler` outside the location block is a no-op for the older ngx_mruby currently used by this buildpack, but ensures compatibility with the newer ngx_mruby being used in the upcoming Heroku-20 support PR. See matsumotory/ngx_mruby#210. --- CHANGELOG.md | 1 + scripts/config/templates/nginx.conf.erb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cc910a2..97b116d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +* [#181](https://github.com/heroku/heroku-buildpack-static/pull/181) Fix compatibility with ngx_mruby 1.18.4+ * [#177](https://github.com/heroku/heroku-buildpack-static/pull/177) Make curl retry in case of a failed download * [#177](https://github.com/heroku/heroku-buildpack-static/pull/177) Fix the printing of the installed nginx version * [#177](https://github.com/heroku/heroku-buildpack-static/pull/177) Switch to the recommended S3 URL format diff --git a/scripts/config/templates/nginx.conf.erb b/scripts/config/templates/nginx.conf.erb index f128862b..0a6b7aea 100644 --- a/scripts/config/templates/nginx.conf.erb +++ b/scripts/config/templates/nginx.conf.erb @@ -55,8 +55,9 @@ http { auth_basic_user_file <%= basic_auth_htpasswd_path %>; <% end %> + mruby_post_read_handler /app/bin/config/lib/ngx_mruby/headers.rb cache; + location / { - mruby_post_read_handler /app/bin/config/lib/ngx_mruby/headers.rb cache; mruby_set $fallback /app/bin/config/lib/ngx_mruby/routes_fallback.rb cache; <% if clean_urls %> try_files $uri.html $uri $uri/ $fallback;