Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
caddy
Commits
cae98808
Commit
cae98808
authored
Jan 06, 2016
by
Matt Holt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #483 from benschumacher/master
letsencrypt: Make plaintext redirect hosts honor the Bind settings
parents
b6326d40
82b0c0b9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
5 deletions
+10
-5
caddy/directives.go
caddy/directives.go
+1
-1
caddy/letsencrypt/letsencrypt.go
caddy/letsencrypt/letsencrypt.go
+3
-2
caddy/letsencrypt/letsencrypt_test.go
caddy/letsencrypt/letsencrypt_test.go
+6
-2
No files found.
caddy/directives.go
View file @
cae98808
...
...
@@ -42,8 +42,8 @@ func init() {
var
directiveOrder
=
[]
directive
{
// Essential directives that initialize vital configuration settings
{
"root"
,
setup
.
Root
},
{
"tls"
,
setup
.
TLS
},
// letsencrypt is set up just after tls
{
"bind"
,
setup
.
BindHost
},
{
"tls"
,
setup
.
TLS
},
// letsencrypt is set up just after tls
// Other directives that don't create HTTP handlers
{
"startup"
,
setup
.
Startup
},
...
...
caddy/letsencrypt/letsencrypt.go
View file @
cae98808
...
...
@@ -445,8 +445,9 @@ func redirPlaintextHost(cfg server.Config) server.Config {
}
return
server
.
Config
{
Host
:
cfg
.
Host
,
Port
:
"http"
,
Host
:
cfg
.
Host
,
BindHost
:
cfg
.
BindHost
,
Port
:
"http"
,
Middleware
:
map
[
string
][]
middleware
.
Middleware
{
"/"
:
[]
middleware
.
Middleware
{
redirMidware
},
},
...
...
caddy/letsencrypt/letsencrypt_test.go
View file @
cae98808
...
...
@@ -38,14 +38,18 @@ func TestHostQualifies(t *testing.T) {
func
TestRedirPlaintextHost
(
t
*
testing
.
T
)
{
cfg
:=
redirPlaintextHost
(
server
.
Config
{
Host
:
"example.com"
,
Port
:
"http"
,
Host
:
"example.com"
,
BindHost
:
"93.184.216.34"
,
Port
:
"http"
,
})
// Check host and port
if
actual
,
expected
:=
cfg
.
Host
,
"example.com"
;
actual
!=
expected
{
t
.
Errorf
(
"Expected redir config to have host %s but got %s"
,
expected
,
actual
)
}
if
actual
,
expected
:=
cfg
.
BindHost
,
"93.184.216.34"
;
actual
!=
expected
{
t
.
Errorf
(
"Expected redir config to have bindhost %s but got %s"
,
expected
,
actual
)
}
if
actual
,
expected
:=
cfg
.
Port
,
"http"
;
actual
!=
expected
{
t
.
Errorf
(
"Expected redir config to have port '%s' but got '%s'"
,
expected
,
actual
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment