mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
parent
d5fa42da3c
commit
c2a3cb622e
2 changed files with 162 additions and 149 deletions
|
@ -87,11 +87,11 @@ func ParseTemplate(path, name string, bindData map[string]TVariable) (c ConfigDe
|
|||
custom := ""
|
||||
content := ""
|
||||
for {
|
||||
bytes, _, err := r.ReadLine()
|
||||
lineBytes, _, err := r.ReadLine()
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
orig := string(bytes)
|
||||
orig := string(lineBytes)
|
||||
line := strings.TrimSpace(orig)
|
||||
switch {
|
||||
case line == "# Nginx UI Custom Start":
|
||||
|
|
|
@ -2,5 +2,18 @@
|
|||
name = "HTTP to HTTPS"
|
||||
author = "@0xJacky"
|
||||
description = { en = "HTTP force redirect to HTTPS Config", zh_CN = "HTTP 强制跳转 HTTPS 配置"}
|
||||
|
||||
[variables.host]
|
||||
type = "string"
|
||||
name = { en = "Host", zh_CN = "主机"}
|
||||
value = ""
|
||||
# Nginx UI Template End
|
||||
|
||||
{{- if .host }}
|
||||
if ($host == {{ .host }}) {
|
||||
return 307 https://$server_name$request_uri;
|
||||
}
|
||||
return 404;
|
||||
{{ else }}
|
||||
return 307 https://$server_name$request_uri;
|
||||
{{- end }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue