1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 11:51:57 +00:00
srs/trunk/3rdparty/httpx-static
Winlin 6f42ca67cb
Support SRS Stack token for authentication. v6.0.74 (#3794)
When accessing the SRS Stack, you should log in and use a token for each
request, or utilize the HTTP API with a secret Bearer token included in
every request. The SRS Stack HTTP API proxies both /api/v1 and /rtc/v1
to the SRS HTTP API while ensuring secure authentication. Additionally,
there is a console in the SRS Stack that requires the same token to
request the SRS Stack HTTP API, which is then proxied to the SRS HTTP
API.

The SRS Stack runs SRS with the HTTP API listening at 127.0.0.1:1985 on
the local loopback interface, allowing only the SRS Stack to access it
without authentication. All other users must login and access the SRS
Stack through its interface, rather than directly accessing the SRS HTTP
API within the SRS Stack.

---------

Co-authored-by: panda <542638787@qq.com>
2023-09-08 08:22:45 +08:00
..
html SquashSRS4: Add one to one RTC demo. 2021-05-02 21:46:41 +08:00
vendor SquashSRS4: Add one to one RTC demo. 2021-05-02 21:46:41 +08:00
.gitignore Squash: Merge SRS 4.0 2021-10-10 12:05:26 +08:00
go.mod SquashSRS4: Add one to one RTC demo. 2021-05-02 21:46:41 +08:00
go.sum SquashSRS4: Add one to one RTC demo. 2021-05-02 21:46:41 +08:00
main.go SRS5: CORS: Refine HTTP CORS headers. v5.0.130 2023-01-05 20:45:26 +08:00
main_test.go SquashSRS4: Add one to one RTC demo. 2021-05-02 21:46:41 +08:00
Makefile SquashSRS4: Add one to one RTC demo. 2021-05-02 21:46:41 +08:00
mcerts.go SquashSRS4: Add one to one RTC demo. 2021-05-02 21:46:41 +08:00
README.md Support SRS Stack token for authentication. v6.0.74 (#3794) 2023-09-08 08:22:45 +08:00
version.go SRS5: CORS: Refine HTTP CORS headers. v5.0.130 2023-01-05 20:45:26 +08:00

HTTPX

A HTTP/HTTPS Server, support letsencrypt or self-sign HTTPS and proxying HTTP as HTTPS.

Docker for https://github.com/ossrs/go-oryx

Build at https://code.aliyun.com/ossrs/go-oryx

Images at https://cr.console.aliyun.com/repository/cn-hangzhou/ossrs/httpx/images

Remark: Requires GO1.8+

Usage

HTTP: Start a HTTP static server

go install github.com/ossrs/go-oryx/httpx-static@latest &&
$HOME/go/bin/httpx-static -http 8080 -root `pwd`

Open http://localhost:8080/ in browser.

HTTPS self-sign: Start a HTTPS static server

go install github.com/ossrs/go-oryx/httpx-static@latest &&
openssl genrsa -out server.key 2048 &&
subj="/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=me.org" &&
openssl req -new -x509 -key server.key -out server.crt -days 365 -subj $subj &&
$HOME/go/bin/httpx-static -https 8443 -root `pwd`

Open https://localhost:8443/ in browser.

Remark: Click ADVANCED => Proceed to localhost (unsafe), or type thisisunsafe in page.

HTTPS proxy: Proxy http as https

go install github.com/ossrs/go-oryx/httpx-static@latest &&
openssl genrsa -out server.key 2048 &&
subj="/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=me.org" &&
openssl req -new -x509 -key server.key -out server.crt -days 365 -subj $subj &&
$HOME/go/bin/httpx-static -https 8443 -root `pwd` -proxy http://ossrs.net:1985/api/v1

Open https://localhost:8443/api/v1/summaries in browser.

Docker

Run httpx-static in docker:

docker run --rm -p 80:80 -p 443:443 registry.cn-hangzhou.aliyuncs.com/ossrs/httpx:v1.0.19

Note: More images and version is here.

To proxy to other dockers, in macOS:

CANDIDATE=$(ifconfig en0 inet| grep 'inet '|awk '{print $2}') &&
docker run --rm -p 80:80 -p 443:443 registry.cn-hangzhou.aliyuncs.com/ossrs/httpx:v1.0.19 \
    ./bin/httpx-static -http 80 -https 443 -ssk ./etc/server.key -ssc ./etc/server.crt \
        -proxy http://$CANDIDATE:8080/

History

  • v0.0.3, 2017-11-03, Support multiple proxy HTTP to HTTPS.

Winlin 2017