paskudnyprogramista
paskudnyprogramista

Reputation: 43

Is there an equivalent of `puma-dev` in Phoenix?

I want to run my development server under custom domain and subdomain, ex.: https://api.custom.local/. In Rails I would use puma-dev, is there an equivalent of this tool in Phoenix?

Upvotes: 1

Views: 212

Answers (2)

paskudnyprogramista
paskudnyprogramista

Reputation: 43

I've followed Justin answer and made a little research on puma-dev.

We can use puma-dev as reverse proxy for Phoenix app.

Prerequisites

Follow puma-dev README in order to install it.

Phoenix endpoint development configuration

url: [
  sheme: "https",
  host: "api.custom.test"
],
https: [
  port: 443,
  cipher_suite: :strong,
  keyfile: System.get_env("SSL_KEYFILE_PATH"),
  certfile: System.get_env("SSL_CERTFILE_PATH")
]

Result

We can access https://api.custom.test

Note

puma-dev allows to add custom domains by executing puma-dev -install -d local

Upvotes: 0

Justin Wood
Justin Wood

Reputation: 10041

Edit your config/dev.exs file. Chave the configuration of MyApp.Endpoint. You will want to add or edit the :url key. You can do something like the following

url: [host: "api.custom.local", port: 4000]

Then you can just start your application as your normally would.

Upvotes: 1

Related Questions