URL Redirect

Hello @Nicd,

Thanks for your response.

I tried your suggestion as below:

get “/testurl” do
conn |> Plug.Conn.put_status(:found) |> Plug.Conn.put_resp_header(“location”, “https://google.com”)
end

Below is the result:

Request: GET /testurl
** (exit) an exception was raised:
** (Plug.Conn.NotSentError) a response was neither set nor sent from the connection
(plug_cowboy) lib/plug/cowboy/handler.ex:37: Plug.Cowboy.Handler.maybe_send/2
(plug_cowboy) lib/plug/cowboy/handler.ex:13: Plug.Cowboy.Handler.init/2

Any ideas, please?