Skip to content
New issue

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

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

Already on GitHub? # to your account

HTTP/HTTPS: Reuse or merge port for API and Stream to avoid HTTP Proxy, to avoid proxy, it is recommended to reuse the port. #2881

Closed
winlinvip opened this issue Jan 14, 2022 · 4 comments
Assignees
Labels
Enhancement Improvement or enhancement. Feature It's a new feature. TransByAI Translated by AI/GPT.
Milestone

Comments

@winlinvip
Copy link
Member

winlinvip commented Jan 14, 2022

The SRS 4.0 HTTP API and Stream listen at different ports, so we must use a HTTP proxy if listen at a single HTTP or HTTPS port. Note that SRS 5.0 supports HTTP API and Stream listen at the same port, such as 8080.

Translation: Currently, the HTTP API and Stream design of SRS 4.0 are separate in order to support API listening on a separate port. However, in simple scenarios, it is inconvenient to use as it requires relying on an external HTTP proxy to combine the API and Stream on a single port.

Note: SRS 5.0 supports using the same port, such as 8080, for both HTTP API and Stream transmission, eliminating the need for a reverse proxy.

You could also use the default self-signed SSL certs, please search thisisunsafe from Wiki.

Ports

SRS 4.0 HTTP API ports:

  • 1985 HTTP API
  • 1990 HTTPS API

SRS 4.0 HTTP Stream ports:

  • 8080 HTTP Stream
  • 8088 HTTPS Stream

SRS 5.0 + HTTP API and Stream ports:

  • 8080 HTTP API and Stream
  • 8088 HTTPS API and Stream

Note: You can config http_api.listen to the same as http_server.listen, such as 8080.

Paths

Nginx Proxy

Caddy Proxy

Nodejs KOA Proxy

HTTPX Proxy

TRANS_BY_GPT3

@winlinvip winlinvip self-assigned this Jan 14, 2022
@winlinvip winlinvip changed the title HTTP: API和Stream复用端口,避免HTTP代理 HTTP: Reuse the same port for API and Stream。API和Stream复用端口,避免HTTP代理 Jan 14, 2022
@winlinvip winlinvip changed the title HTTP: Reuse the same port for API and Stream。API和Stream复用端口,避免HTTP代理 HTTP: Reuse the same port for API and Stream,复用端口,避免HTTP代理 Jan 14, 2022
@winlinvip winlinvip changed the title HTTP: Reuse the same port for API and Stream,复用端口,避免HTTP代理 HTTP: Reuse the same port for API and Stream,HTTP复用端口避免代理 Jan 14, 2022
@winlinvip winlinvip changed the title HTTP: Reuse the same port for API and Stream,HTTP复用端口避免代理 HTTP: Reuse the same port for API and Stream,复用端口避免代理 Jan 14, 2022
@winlinvip winlinvip added Enhancement Improvement or enhancement. Feature It's a new feature. labels Jan 14, 2022
@winlinvip winlinvip added this to the 5.0 milestone Jan 14, 2022
@winlinvip winlinvip changed the title HTTP: Reuse the same port for API and Stream,复用端口避免代理 HTTP/HTTPS: Reuse the same port for API and Stream,复用端口避免代理 Jan 15, 2022
@winlinvip winlinvip changed the title HTTP/HTTPS: Reuse the same port for API and Stream,复用端口避免代理 HTTP/HTTPS: Reuse the same port for API and Stream to avoid HTTP Proxy,复用端口避免代理 Jan 15, 2022
@winlinvip winlinvip changed the title HTTP/HTTPS: Reuse the same port for API and Stream to avoid HTTP Proxy,复用端口避免代理 HTTP/HTTPS: Reuse port for API and Stream to avoid HTTP Proxy,复用端口避免代理 Jan 15, 2022
@jonahzheng
Copy link

jonahzheng commented Jan 15, 2022

Caddy config

:80 {
  gzip
  reverse_proxy / localhost:8080 {
    header_up -Origin
  }
  reverse_proxy /api 127.0.0.1:1985/api/ {
    header_up -Origin
  }
  reverse_proxy /rtc 127.0.0.1:1985/rtc/ {
    header_up -Origin
  }
}

@winlinvip
Copy link
Member Author

winlinvip commented Jan 16, 2022

@jonahzheng What about HTTPS config like Nginx? Apart from HTTP proxy, I want to config the HTTPS with SSL key and cert file.

@finaldzn
Copy link

So i guess this config works if with an ingress and the https being done by the ingress router ?

@dwj1979
Copy link

dwj1979 commented Jun 15, 2022

On the console page, there is a connection that directly accesses port 1985, but the above nginx configuration file does not have a proxy listening on port 1985.

TRANS_BY_GPT3

@winlinvip winlinvip changed the title HTTP/HTTPS: Reuse port for API and Stream to avoid HTTP Proxy,复用端口避免代理 HTTP/HTTPS: Reuse or merge port for API and Stream to avoid HTTP Proxy,复用端口避免代理 Aug 10, 2022
@winlinvip winlinvip changed the title HTTP/HTTPS: Reuse or merge port for API and Stream to avoid HTTP Proxy,复用端口避免代理 HTTP/HTTPS: Reuse or merge port for API and Stream to avoid HTTP Proxy, to avoid proxy, it is recommended to reuse the port. Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Enhancement Improvement or enhancement. Feature It's a new feature. TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

4 participants