Skip to content

Commit

Permalink
Add $PORT bind step in Heroku deployment guide (#3235)
Browse files Browse the repository at this point in the history
* Add $PORT bind step in heroku deployment guide
  • Loading branch information
edwinthinks authored and Gazler committed Jan 21, 2019
1 parent 63a33b2 commit f2fd439
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions guides/deployment/heroku.md
Expand Up @@ -149,6 +149,12 @@ config :hello, Hello.Repo,
ssl: true
```

Afterwards, let's tell the Phoenix application to bind to the PORT environment variable provided by Heroku's [dyno networking](https://devcenter.heroku.com/articles/dynos#common-runtime-networking) so that it can accept incoming web traffic. Add this beneath your endpoint configuration:

```elixir
http: [port: System.get_env("PORT")]
```

Now, let's tell Phoenix to use our Heroku URL and enforce we only use the SSL version of the website. Find the url line:

```elixir
Expand Down Expand Up @@ -182,6 +188,7 @@ use Mix.Config
...

config :hello, HelloWeb.Endpoint,
http: [port: System.get_env("PORT")],
url: [scheme: "https", host: "mysterious-meadow-6277.herokuapp.com", port: 443],
force_ssl: [rewrite_on: [:x_forwarded_proto]],
cache_static_manifest: "priv/static/cache_manifest.json",
Expand Down

0 comments on commit f2fd439

Please sign in to comment.