caddytest: bind: permission denied

Created on 5 May 2020  路  4Comments  路  Source: caddyserver/caddy

@sarge , I am running the following config:

https://github.com/greenpau/caddy-auth-forms/blob/a1817048e2311c2e9b8ce5c43fb83433570a753f/plugin_test.go#L12-L26

Configuration file refers to port 3443:

https://github.com/greenpau/caddy-auth-forms/blob/a1817048e2311c2e9b8ce5c43fb83433570a753f/assets/conf/Caddyfile.json#L11-L15

However, I get the following error:

{"level":"error","ts":1588645443.4411454,"logger":"admin.api","msg":"request error","error":"loading config: loading new config: http app module: start: tcp: listening on :80: listen tcp :80: bind: permission denied","status_code":400}
{"level":"info","ts":1588645443.4412885,"logger":"admin","msg":"stopped previous server"}
2020/05/04 22:24:03 [INFO][cache:0xc0001fc9b0] Started certificate maintenance routine
2020/05/04 22:24:03 caddytest: config load time took 10.342526ms
    TestPlugin: caddytest.go:96: failed to load config: {"error":"loading config: loading new config: http app module: start: tcp: listening on :80: listen tcp :80: bind: permission denied"}
2020/05/04 22:24:03 caddytest: redirecting the dialer from 127.0.0.1:3443 to 127.0.0.1:3443

How to fix the error in the test configuration?

discussion

Most helpful comment

I think it is the automatic http -> https redirection kicking in.

https://github.com/caddyserver/caddy/blob/master/caddytest/integration/sni_test.go#L15-L17

It automatically binds to port 80.

If you set the http_port to something higher like 9080 this should avoid the binding issues

All 4 comments

I'll just close this as a discussion (nothing actionable here for the Caddy project at this time, correct me if I'm wrong)

I'll just close this as a discussion (nothing actionable here for the Caddy project at this time, correct me if I'm wrong)

@francislavoie , there is something actionable here ... The config provided to the test instance is not being respected by the test. Previously, it worked.

I think it is the automatic http -> https redirection kicking in.

https://github.com/caddyserver/caddy/blob/master/caddytest/integration/sni_test.go#L15-L17

It automatically binds to port 80.

If you set the http_port to something higher like 9080 this should avoid the binding issues

I think it is the automatic http -> https redirection kicking in.

@sarge , thank you for the pointer! 馃憤 Adding non-privileged port in http_port worked!

--- a/assets/conf/Caddyfile.json
+++ b/assets/conf/Caddyfile.json
@@ -8,6 +8,7 @@
   },
   "apps": {
     "http": {
+      "http_port": 3080,
       "https_port": 3443,
       "servers": {
         "srv0": {
Was this page helpful?
0 / 5 - 0 ratings

Related issues

lorddaedra picture lorddaedra  路  3Comments

wayneashleyberry picture wayneashleyberry  路  3Comments

muhammadmuzzammil1998 picture muhammadmuzzammil1998  路  3Comments

mikolysz picture mikolysz  路  3Comments

la0wei picture la0wei  路  3Comments