OvermindDL1

OvermindDL1

I’ve been trying to see if Phoenix supports HTTP/2 but I am not able to see any hint of a sign of negotiation or how to PUSH data over HTTP/2? It would be nice if, say, the View’s could specify mandatory files to be pushed to the browser based on their knowledge of the templates for example. Is there something that I am missing?

Showing Posts 50 to 41

ChaseGilliam

ChaseGilliam

I don’t actually know, as I haven’t tried, but based on the docs that seems right.

axelclark

axelclark

Would I typically call Plug.Conn.push/3 from my controller?

ChaseGilliam

ChaseGilliam

The newer versions of Phoenix http2 push, you’ll need to use Plug.Conn.push/3 directly

axelclark

axelclark

Can anyone point me to a good resource for updating my Phoenix project to use HTTP/2? Thanks!

ChaseGilliam

ChaseGilliam

I’ll have to jump on that soon then.

SampsonCrowley

SampsonCrowley

@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

SampsonCrowley

SampsonCrowley

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:

page_controller.ex

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

SampsonCrowley

SampsonCrowley

@ChaseGilliam @LostKobrakai Thanks! I actually did find it while i was waiting for forum permissions by looking through the cowboy plug github

ChaseGilliam

ChaseGilliam

@SampsonCrowley yeah, that domain sadly expired and got scooped up while I was on vacation :frowning:. 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.

LostKobrakai

LostKobrakai

Phoenix removed support for http2 push before the release of 1.4 for reasons. It suggests Plug.Conn.push/3 as alternative.

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
achenet
Hello, I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind. However, when I launch mix phx.server, I get an error...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
Cxx-mlr
I’m working on a small exercise involving update_in/3, and I came up with this solution: data = %{ name: "Periodic Table", category:...
New
ChrisAmelia
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication): toke...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews