mirror of
https://github.com/yudai/gotty.git
synced 2026-01-10 03:28:51 +01:00
add api-prefix flag for nginx path redirect
This commit is contained in:
parent
a080c85cbc
commit
c5ef9697fd
3 changed files with 8 additions and 0 deletions
|
|
@ -4,12 +4,14 @@ import (
|
|||
"context"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strings"
|
||||
noesctmpl "text/template"
|
||||
"time"
|
||||
|
||||
|
|
@ -96,6 +98,9 @@ func (server *Server) Run(ctx context.Context, options ...RunOption) error {
|
|||
counter := newCounter(time.Duration(server.options.Timeout) * time.Second)
|
||||
|
||||
path := "/"
|
||||
if strings.TrimSpace(server.options.ApiPrefix) != "" {
|
||||
path = fmt.Sprintf(`/%s/`, strings.TrimSpace(server.options.ApiPrefix))
|
||||
}
|
||||
if server.options.EnableRandomUrl {
|
||||
path = "/" + randomstring.Generate(server.options.RandomUrlLength) + "/"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue