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

If jwksUri contains a port number, DNS resolution fails #234

Closed
gyszalai opened this issue Mar 16, 2021 · 4 comments
Closed

If jwksUri contains a port number, DNS resolution fails #234

gyszalai opened this issue Mar 16, 2021 · 4 comments

Comments

@gyszalai
Copy link

Describe the problem

JwksClient uses hostname:port for hostname resolution so if the jwksUri contains a port number, hostname resolution fails.
The cause of the problem if that the request wrapper uses the host property from the parsed URL instead of the hostname property.

What was the expected behavior?

Hostname resolution should work even if the jwksUri contains a port number

Reproduction

import JwksClient from 'jwks-rsa'

const jwksClient = JwksClient({
  jwksUri: 'http://myhost:8888/jwks'
})

async function getKey(keyId: string) => {
  const key = await jwksClient.getSigningKey(keyId)
  return { cert: key.getPublicKey() }
}

const key = await getKey('1)

Environment

  • Version of this library used: 2.0.1
  • Which framework are you using, if applicable: -
  • Other modules/plugins/libraries that might be involved: -
  • Any other relevant information you think would be useful: -
@carboneater
Copy link
Contributor

Looks like we have a proposed solution in #233

@gyszalai
Copy link
Author

Sorry, my fault. Didn't check PRs before filing the issue.

@jonjrodriguez
Copy link

Having the same issue when trying to use localstack.

@davidpatrick
Copy link
Contributor

Fixed in #233

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

No branches or pull requests

4 participants