Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP/3 #1653

Open
fiodinggo opened this issue Aug 27, 2024 · 4 comments
Open

HTTP/3 #1653

fiodinggo opened this issue Aug 27, 2024 · 4 comments

Comments

@fiodinggo
Copy link

fiodinggo commented Aug 27, 2024

Hello @essen , i 'll try to create http/3, but doesnt work. the server always running, but doesnt access by browser. and this is my code

start(_Type, _Args) ->
    Dispatch = cowboy_router:compile([
        {'_', [{"/", hello_handler, []}]}
    ]),
    TransOpts = #{
        socket_opts => [
			{port, 8181},
            {certfile, "/ssl/cert.pem"},
            {keyfile, "/ssl/key.pem"}
        ]
    },
    Lst = cowboy:start_quic(
        h3,
        TransOpts, 
        #{
            env => #{dispatch => Dispatch}
        }
    ),
	io:format("Listener ~p~n", [Lst]),
	{ok, Listener} = Lst,
	Port = quicer:sockname(Listener),
	io:format("Port ~p~n", [Port]),
	persistent_term:put({cowboy_quic, h3}, Listener),
    qtrial_sup:start_link().

i use cowboy master for that
it is wrong or not?
thanx before.

@essen
Copy link
Member

essen commented Aug 27, 2024

(Please ignore the spam that got deleted.)

Assuming your certificate paths are correct, in order to make browsers connect you need more than that. You need:

  • a TLS listener with an alt-svc header;
  • or a special DNS field for alt-svc;
  • or to force the browser to use QUIC (varies depending on browser, Chrome has a command line flag for example)

Getting something like curl to work is simpler but you likely will need to compile it manually. https://curl.se/docs/http3.html

@fiodinggo
Copy link
Author

thanks @essen
i will try to.
For placement, will it be placed in the option or in the header on the handler?

@essen
Copy link
Member

essen commented Aug 28, 2024

There's no option at this point.

@fiodinggo
Copy link
Author

ok, i will try it
thanks @essen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@essen @fiodinggo and others