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

caddyhttp: Adjust scheme placeholder docs #5910

Merged
merged 1 commit into from
Oct 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/caddyhttp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func init() {
// `{http.request.remote.host}` | The host (IP) part of the remote client's address
// `{http.request.remote.port}` | The port part of the remote client's address
// `{http.request.remote}` | The address of the remote client
// `{http.request.scheme}` | The request scheme
// `{http.request.scheme}` | The request scheme, typically `http` or `https`
Copy link
Contributor

@coolaj86 coolaj86 Oct 23, 2023

Choose a reason for hiding this comment

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

Are there other possible values?

I thought this was essentially an alias for "encrypted" and always said http for plain text, and always said https for TLS, regardless of HTTP2, etc.

I know there are other possible schemes, such as "skype:" and "gopher:", but I thought that this value referred not to what a user typed in a URL bar, but to the same property that is reflected by X-Forwarded-Proto.

But I suppose Caddy can now be an FTP or SMTP server via Plugin and therefore this value could reflect those schemes?

Copy link
Member Author

Choose a reason for hiding this comment

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

The code is literally this right now:

			case "http.request.scheme":
				if req.TLS != nil {
					return "https", true
				}
				return "http", true

So it's only those two values.

But I suppose Caddy can now be an FTP or SMTP server via Plugin?

Yes, but that wouldn't be under http.request because it would happen in a different Caddy app.

// `{http.request.tls.version}` | The TLS version name
// `{http.request.tls.cipher_suite}` | The TLS cipher suite
// `{http.request.tls.resumed}` | The TLS connection resumed a previous connection
Expand Down
Loading