Can someone please give a single example of actually sending an HTTP/2 Push? or even just a sample of checking if the client supports it? I can’t seem to find it ANYWHERE in the phoenix docs. do we have to use cowboy directly??
Phoenix removed support for http2 push before the release of 1.4 for reasons. It suggests
Plug.Conn.push/3 as alternative.
@SampsonCrowley yeah, that domain sadly expired and got scooped up while I was on vacation . But, I put the site back up under a new domain https://by-cha.se. As @LostKobrakai mentioned, push was removed from Phoenix, but you can accomplish the same thing with Plug.Conn.push/3.
That said, you can get the same effect with less work using a CDN like Cloudflare.
I found out the hard way you actually don’t have to use webpack-dev-server to get this going in development either. Phoenix is capable of pushing the resource directly from the build. webpack-dev-server really caused a lot of headache because I could not figure out why it was still using 1.1; until i realized that it can’t support http/2 if you’re using node >= 11.1
test sample from my own codebase:
defmodule DownUnderSportsWeb.PageController do use DownUnderSportsWeb, :controller def index(conn, _params) do push(conn, Routes.static_path(conn, "/js/shared-runtime.js")) push(conn, Routes.static_path(conn, "/js/vendors~app.js")) push(conn, Routes.static_path(conn, "/js/app.js")) push(conn, Routes.static_path(conn, "/css/app.css")) render(conn, "index.html") end end
this works for both development and production, because it uses the normal asset pipeline to find the same resources it would without proxying it through webpack
@ChaseGilliam I think your original domain is back up for purchase if you wanted it back
Edit: nevermind, I think it’s only available through the people that scooped it up in the first place
I’ll have to jump on that soon then.