Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caddyfile support #4

Merged

Conversation

francislavoie
Copy link
Contributor

@francislavoie francislavoie commented Nov 23, 2020

FYI @mholt, @JackEllis

Closes #1

{
	servers {
		listener_wrappers {
			proxy_protocol {
				timeout 2s
				allow 0.0.0.0/0 1.2.3.4/0
			}
			tls
		}
	}
}

foo.com {
}

This is now possible since caddyserver/caddy#3836 is merged.

I haven't tested this yet, slight issue with xcaddy preventing me from compiling, but @mholt is looking into it.

Tested, the above Caddyfile gives this JSON:

{
	"apps": {
		"http": {
			"servers": {
				"srv0": {
					"listen": [
						":443"
					],
					"listener_wrappers": [
						{
							"allow": [
								"0.0.0.0/0",
								"1.2.3.4/0"
							],
							"timeout": 2000000000,
							"wrapper": "proxy_protocol"
						},
						{
							"wrapper": "tls"
						}
					],
					"routes": [
						{
							"match": [
								{
									"host": [
										"foo.com"
									]
								}
							],
							"terminal": true
						}
					]
				}
			}
		}
	}
}

Ready to go!

@francislavoie francislavoie force-pushed the caddyfile-support branch 2 times, most recently from 45e1e74 to d2b6765 Compare November 23, 2020 20:42
Copy link

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that my review matters too much here, but LGTM 😄

@francislavoie
Copy link
Contributor Author

Latest release can make use of this now: https://github.com/caddyserver/caddy/releases/tag/v2.3.0-beta.1

Think you could review/try it @mastercactapus?

@crysper
Copy link

crysper commented Dec 9, 2020

:) we're waiting for this as well

@francislavoie
Copy link
Contributor Author

@crysper For now, you can build like this:

$ xcaddy build v2.3.0-beta.1 --with github.com/francislavoie/caddy2-proxyprotocol@1326994

I just updated the master branch on my fork to have the right module name in go.mod.

@crysper
Copy link

crysper commented Dec 10, 2020

Thanks a lost @francislavoie .Wondering how stable the beta is because we want to use it in production. Any timeframe when the 2.3 comes out of beta?

@francislavoie
Copy link
Contributor Author

There's been a small handful of commits to the master branch since to fix small bugs and to add a few small features, but otherwise it's pretty stable. You could also build right from master instead (specify the commit hash of the latest commit on master instead of the beta tag in the xcaddy command) to get all the current fixes. We don't have a set time when we'll release the stable 2.3 version but it's essentially ready now. We're just waiting for people to try it and report any possible issues. You should try it on your staging environment first, then you can use it in production.

@mholt
Copy link

mholt commented Dec 10, 2020

I would add a disclaimer of course, to always thoroughly test beta software before using it in production. :) But no major issues have been reported recently, and everything significant I can think of is fixed on the master branch.

Francis is right though, we just need more people to use it at this point before we tag the release. So please do try the beta -- carefully, within your tolerances -- and let us know if there's bugs!

@crysper
Copy link

crysper commented Dec 13, 2020

Thanks @francislavoie and @mholt We compiled the 2.3.0-beta.1, made some tests and put it on a low-risk production environment (100+ req/minute). If something comes up will report.

@francislavoie
Copy link
Contributor Author

Caddy v2.3 is now released https://github.com/caddyserver/caddy/releases/tag/v2.3.0

@mastercactapus could you please merge this PR?

@karlprieb
Copy link

@francislavoie thanks for this PR. I'm already using it on a prod environment successfully 😄

@mastercactapus any chances to get this merged?

@mastercactapus mastercactapus merged commit 8cd1772 into mastercactapus:master Jan 29, 2021
@francislavoie francislavoie deleted the caddyfile-support branch January 29, 2021 04:48
@mholt
Copy link

mholt commented Jan 29, 2021

Thank you Nathaniel! Really appreciate it. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Caddyfile support
5 participants