From f2fd439eae16bf85c5ad893df11dd92e176c5758 Mon Sep 17 00:00:00 2001 From: Edwin Mak Date: Mon, 21 Jan 2019 04:22:59 -0500 Subject: [PATCH] Add $PORT bind step in Heroku deployment guide (#3235) * Add $PORT bind step in heroku deployment guide --- guides/deployment/heroku.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/guides/deployment/heroku.md b/guides/deployment/heroku.md index d0070d2c6b..98c5cf6fb5 100644 --- a/guides/deployment/heroku.md +++ b/guides/deployment/heroku.md @@ -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 @@ -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",