vrod

vrod

Multiple HTTPS sites on Gigalixir using master_proxy

I made a post before 1 Gigalixir instance hosting multiple HTTPS sites - #5 by axelson
but I am still not understanding how can I support https. The multi_proxy config was a little bit difficult, but I think as long as your endpoints do not specify a port and they let multi_proxy define the port, it works. But if you have https, I do not see what options are needed (or maybe, it isn’t needed?)

config :master_proxy,
  http: [port: 80],
  #  http: [port: String.to_integer(System.get_env("PORT", "4000"))],  # <--- is this better?
  #  https: [:inet6, port: 443],   # <--- this causes an error.  How to specify a local cert?
  backends: [
    %{
      host: ~r{^(www\.)?myapp\.com$},
      phoenix_endpoint: MyAppWeb.Endpoint
    },
  ]

If https is uncommented, it gets this error:

(ArgumentError) could not start Cowboy2 adapter, missing option :key/:keyfile

but I do not understand how to fix this in dev.

Also I do not understand whether master_proxy should be listening on port 4000 (the PORT), or if it should be listening on port 80.

Thank you sorry I am confused

Marked As Solved

hubertlepicki

hubertlepicki

I think the way Gigalixir works (and also Heroku, Render.com etc) is that they provide you the SSL layer for you, and in your own application you should only be concerned with HTTP layer, and maybe a redirect from HTTP to HTTPS.

So you set up your application the usual way, with listening only over HTTP on $PORT, then add custom domains in Gigalixir and set up redirect - all without changing anything in your code, but rather by altering the Gigalixir configuration with it’s CLI:

Where Next?

Popular in Questions Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 40082 209
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 42576 114
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement