Proxy targets with hyphens may cause ParseInt() issues

I’m running Caddy as a proxy in front of an artifactory server. The config below worked find for Caddy 8.2:

https://chocolatey.eng.foobar.io {
  proxy / http://artifactory.foobar.corp.msp:8081/artifactory/api/nuget/chocolatey-virtual {
    proxy_header Host {host}
  }
  log /var/log/caddy/chocolatey-proxy.log
  tls /etc/lego/certificates/chocolatey.eng.foobar.io.crt /etc/lego/certificates/chocolatey.eng.foobar.io.key
}

Now we are getting this error on startup:

# caddy --conf=/etc/Caddyfile
Activating privacy features... done.
2016/07/20 03:47:34 strconv.ParseInt: parsing "8081/artifactory/api/nuget/chocolatey": invalid syntax

If I remove the path portion of the URL ("/artifactory/api/nuget/chocolatey-virtual") the config works.

Apologies if I’m missing a release note, or am misunderstanding the documentation. But how do I specify a path into the destination endpoint? Is this even supported?

I’d have to check the commit logs but it does seem like we might have changed how we parse the destination URLs; it seems to assume that the destination is just a host and port, not a path. This is probably a bug. Would you file an issue so we can track it better? We’ll try to add tests too.

Thanks for reporting that!

Thanks for responding. I reported a bug and then dug in a bit for a simpler fail case and found it was the hyphen in the target URL. But before I could update the bug @tw4452852 had already discerned this. Awesome!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.