polypush135

polypush135

Mix phx.gen.cert for wildcard certs

I’m creating a white label site for elixir user groups.
https://github.com/PDX-Elixir-Group/elixir.group

One of the main ideas is that I want to subdomain each user group. ie: I own elixir.group and I want to setup a group as pdx.elixir.group

I’ve been able to successfully setup self signed certs for just a single domain locally via mix phx.gen.cert which fyi is awesome ! but I’m having a hard time trying to get a wildcard cert working. Any pointers?

Has anyone else been able to successfully do this locally?

Most Liked

voltone

voltone

It works for me:

$ mix phx.new wildcard --no-ecto --no-webpack
* creating wildcard/config/config.exs
* creating wildcard/config/dev.exs
[...snip...]
$ cd wildcard
$ mix phx.gen.cert localhost "*.localhost"
* creating priv/cert/selfsigned_key.pem
* creating priv/cert/selfsigned.pem
[..snip...]
$ vim config/dev.exs
# Edit as instructed
$ sudo vim /etc/hosts
# Add localhost subdomain
$ head -1 /etc/hosts
127.0.0.1 localhost localhost.localdomain test.localhost
$ iex -S mix phx.server
Erlang/OTP 21 [erts-10.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

[info] Running NewV140Web.Endpoint with cowboy 2.6.0 at https://localhost:4001
[info] Running NewV140Web.Endpoint with cowboy 2.6.0 at https://localhost:4001
Interactive Elixir (1.7.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> 

Opening https://localhost:4001/ and https://test.localhost:4001/ works in both Chrome and Firefox. Of course I need to confirm trusting the self-signed cert, but that’s expected.

Can you please clarify what’s not working for you?

Last Post!

polypush135

polypush135

As you can see in my later screen shot I’ve already approved the certs and have set the flag in chrome. I have also tried this in other browsers too with no luck.

Where Next?

Popular in Questions Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
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

Other popular topics Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 44778 311
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement