heroku / heroku-buildpack-static

[DEPRECATED] Heroku buildpack for handling static sites and single page web apps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Redirect for root doesn't seem to work

cancan101 opened this issue · comments

This does not seem to work:

    "redirects": {
      "/": {
        "url": "https://page.example"
      }
    }

Instead I get in the logs:

[error] 35#0: *6 directory index of "./dist/" is forbidden, client: XXXX, server: , request: "GET / HTTP/1.1", host: "YYYYY-pr-23.herokuapp.com"

Probably due to this block being explicit :

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;
<% else %>
try_files $uri $uri/ $fallback;
<% end %>
}

I followed #53 (comment) and add this script which seems to fix the issue:

sed -i 's:try_files $uri.html $uri $uri/ $fallback;:try_files $uri.html $uri $fallback;:g' /app/bin/config/templates/nginx.conf.erb

Hi

This buildpack is now deprecated and we are recommending people move the more actively maintained heroku-buildpack-nginx. For migration advice see here.

As such, I'm closing this issue out since we won't be making further changes to this buildpack.