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 and HTTPS on the same port #48

Open
daxpedda opened this issue Jul 25, 2022 · 7 comments
Open

HTTP and HTTPS on the same port #48

daxpedda opened this issue Jul 25, 2022 · 7 comments

Comments

@daxpedda
Copy link
Collaborator

I wrote an Acceptor that allows handling of HTTP and HTTPS on the same port.
The implementation is fairly minimal and simple. Is it in scope for axum-server to add something like this? Happy to start a PR of course.

My use-case is hosting a HTTPS server on a custom port, unlike the example, there is only one port. So connecting with HTTP to that server errors out.
The idea is if I accept both protocols, I can design a middleware that handles the redirect.

@programatik29
Copy link
Owner

I think it is out of scope. Keep the issue open for a while in case there is a demand for this.

@daxpedda
Copy link
Collaborator Author

I released a crate doing all of this now: https://crates.io/crates/axum-server-dual-protocol.

@hangj
Copy link

hangj commented Sep 19, 2022

When I send http request to my https server, the server just close the connection, reply me nothing, while I expect an error code like 497.

@daxpedda
Copy link
Collaborator Author

@hangj I assume you mean this is the current behavior of axum-server and not axum-server-dual-protocol?

@hangj
Copy link

hangj commented Sep 19, 2022

@daxpedda yes, its the current behavior of axum-server

@programatik29
Copy link
Owner

When I send http request to my https server, the server just close the connection, reply me nothing, while I expect an error code like 497.

You can't use same port for http and https if you are asking that. You might want to check out axum-server-dual-protocol if you want to do that. If the problem is that https not working then write an example and I will look into it.

@hangj
Copy link

hangj commented Sep 20, 2022

When I send http request to my https server, the server just close the connection, reply me nothing, while I expect an error code like 497.

You can't use same port for http and https if you are asking that. You might want to check out axum-server-dual-protocol if you want to do that. If the problem is that https not working then write an example and I will look into it.

Thank you, I'll check it out, and see what I can do.

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

3 participants