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

Respect host scheme if set #310

Merged
merged 1 commit into from
Apr 23, 2024
Merged

Conversation

gabe565
Copy link
Contributor

@gabe565 gabe565 commented Apr 23, 2024

Hi!

This PR changes the Host config and GEOIPUPDATE_HOST env to respect the scheme if set. If not set, behavior is unchanged and the scheme will default to https://. A nice side-effect is that the url.Parse() step will cause the host value to be validated during the config load phase. I also updated the docs to reflect that the default value is https://, but since it's optional, feel free to let me know if you'd prefer to keep these unchanged.

For some background, I have a local Kubernetes job which requires a GeoIP database. I'd prefer to avoid attaching storage for reliability, but I don't want to fetch the database each run. I built an internal service which proxies the GeoIP API and caches the response for a time, and would rather keep communication internal without requiring proxies or HTTPS certificates.

Thank you!

Copy link
Member

@oschwald oschwald left a comment

Choose a reason for hiding this comment

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

Nice! Thanks for providing the explanation with the use case.

@oschwald oschwald merged commit 7d06f1c into maxmind:main Apr 23, 2024
9 checks passed
oschwald added a commit that referenced this pull request Apr 23, 2024
NajiObeid added a commit that referenced this pull request Apr 23, 2024
@gabe565 gabe565 deleted the respect-host-scheme branch April 23, 2024 19:38
oschwald added a commit that referenced this pull request Nov 18, 2024
7.1.0

* Allow the `Host` configuration directive and the `GEOIPUPDATE_HOST`
  environment variable to accept a value with the scheme set. If not set, it
  will continue to default to `https://`. Pull request by Gabe Cook. GitHub
  #310.
* Export `HTTPError` to enable fine-grained error handling for users of
  `github.com/maxmind/geoipupdate/client`. Pull request by Ryan Davis. GitHub
  #341.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants