mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-12 02:45:49 +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 := ""
|
custom := ""
|
||||||
content := ""
|
content := ""
|
||||||
for {
|
for {
|
||||||
bytes, _, err := r.ReadLine()
|
lineBytes, _, err := r.ReadLine()
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
orig := string(bytes)
|
orig := string(lineBytes)
|
||||||
line := strings.TrimSpace(orig)
|
line := strings.TrimSpace(orig)
|
||||||
switch {
|
switch {
|
||||||
case line == "# Nginx UI Custom Start":
|
case line == "# Nginx UI Custom Start":
|
||||||
|
|
|
@ -2,5 +2,18 @@
|
||||||
name = "HTTP to HTTPS"
|
name = "HTTP to HTTPS"
|
||||||
author = "@0xJacky"
|
author = "@0xJacky"
|
||||||
description = { en = "HTTP force redirect to HTTPS Config", zh_CN = "HTTP 强制跳转 HTTPS 配置"}
|
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
|
# 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;
|
return 307 https://$server_name$request_uri;
|
||||||
|
{{- end }}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue