(httpsPort int)
| 507 | } |
| 508 | |
| 509 | func (s *Server) AddHTTP2HTTPS(httpsPort int) { |
| 510 | newDir := Directive{ |
| 511 | Name: "if", |
| 512 | Parameters: []string{"($scheme = http)"}, |
| 513 | Block: &Block{}, |
| 514 | } |
| 515 | block := &Block{} |
| 516 | if httpsPort == 443 { |
| 517 | block.AppendDirectives(&Directive{ |
| 518 | Name: "return", |
| 519 | Parameters: []string{"301", "https://$host$request_uri"}, |
| 520 | }) |
| 521 | } else { |
| 522 | block.AppendDirectives(&Directive{ |
| 523 | Name: "return", |
| 524 | Parameters: []string{"301", fmt.Sprintf("https://$host:%d$request_uri", httpsPort)}, |
| 525 | }) |
| 526 | } |
| 527 | |
| 528 | newDir.Block = block |
| 529 | s.UpdateDirectiveBySecondKey("if", "($scheme", newDir) |
| 530 | } |
| 531 | |
| 532 | func (s *Server) UpdateAllowIPs(ips []string) { |
| 533 | index := -1 |
no test coverage detected