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

feat: Automatically set tls.servername option with rediss:// URLs #950

Closed
wants to merge 3 commits into from

Conversation

paulmelnikow
Copy link
Contributor

@paulmelnikow paulmelnikow commented Aug 20, 2019

Fix #948
Fix #940
Alternative to #949 and #942

@paulmelnikow paulmelnikow force-pushed the auto-tls-hostname branch 2 times, most recently from 9ddb978 to 90040f9 Compare August 20, 2019 17:22
@paulmelnikow
Copy link
Contributor Author

@luin Would you mind taking a look at this? It would be great to get this merged as Shields is currently blocked from upgrading. Thanks a lot!

} else if (typeof arg === "number") {
this.options.port = arg;
} else {
throw new Error("Invalid argument " + arg);
}
}
if (isTls) {
defaults(this.options, { tls: { servername: this.options.host } });
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure if setting tls to this.options.host instead of true applies to more scenarios, but I think at least we need to check whether this.options.host is a hostname instead of an IP address.

As for me, I prefer the way that we just default tls options to true without setting any other properties (like servername) and let users handle it. The improvement we should make here is to keep the options provided by users not be overwritten.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if setting tls to this.options.host instead of true applies to more scenarios, but I think at least we need to check whether this.options.host is a hostname instead of an IP address.

I'm happy to make that modification if you'd like.

Setting tls.options.host to the hostname of the server is necessary to use many shared Redis hosting services, including Compose.io and Redis Labs. It reduces boilerplate and seems like a reasonable default as this is not really a fringe use case, but a common scenario for TLS.

The improvement we should make here is to keep the options provided by users not be overwritten.

Alternatively, #949 does just that!

ioredis-robot pushed a commit that referenced this pull request Aug 27, 2019
## [4.14.1](v4.14.0...v4.14.1) (2019-08-27)

### Bug Fixes

* don’t clobber passed-in tls options with rediss:/ URLs ([#949](#949)) ([ceefcfa](ceefcfa)), closes [#942](#942) [#940](#940) [#950](#950) [#948](#948)
@luin luin closed this Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants