mars/create-react-app-buildpack

HTTPS-only does not work

j4nos opened this issue · 3 comments

j4nos commented

I did set static.json as show in doc, but still http is allowed. What am I doing wrong?
Képernyőfotó 2019-11-12 - 9 57 05

Képernyőfotó 2019-11-12 - 9 57 30

mars commented

HTTPS is only supported when deployed to Heroku with this buildpack.

Are you trying to use HTTPS locally? Local create-react-app dev is plain HTTP only.

Otherwise confirm that you’re actually deploying that change. Is the HTTPS config on a branch other than master? If so you may accidentally be deploying the wrong branch. To push a non-master branch to Heroku:

git push heroku other-branch:master

Set other-branch to your local branch you wish to deploy.

j4nos commented

static.json

{
  "root": "build/",
  "routes": {
    "/**": "index.html"
  },
  "https_only": true,
  "headers": {
    "/**": {
      "Strict-Transport-Security": "max-age=31557600"
    }
  }
}

worked

@j4nos I am having a similar issue, but it wont work with Strict-Transport-Security header either, i noticed your static.json is not in the root folder. Is ur static.json in the same folder as your Procfile?