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

Allow path-style addressing when proxy is using virtual host #146

Merged
merged 1 commit into from
Aug 14, 2024

Conversation

mosiac1
Copy link
Contributor

@mosiac1 mosiac1 commented Aug 14, 2024

This changes the behaviour of RequestFilter so that:

  1. If the request host matches some-bucket.${hostname}/some-object then bucket=some-bucket and key=some-key;
  2. Otherwise, the host is ignored and the bucket and key are read from the path.

@cla-bot cla-bot bot added the cla-signed label Aug 14, 2024
Copy link
Contributor

@pranavr12 pranavr12 left a comment

Choose a reason for hiding this comment

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

LGTM

@mosiac1 mosiac1 requested a review from Randgalt August 14, 2024 15:35
@@ -98,7 +98,7 @@ record BucketAndKey(String bucket, String rawKey) {}
.flatMap(serverHostNameValue -> {
String lowercaseServerHostName = serverHostNameValue.toLowerCase(Locale.ROOT);
return Optional.of(request.requestUri().getHost())
.filter(value -> value.endsWith(lowercaseServerHostName))
.filter(value -> value.endsWith(lowercaseServerHostName) && !value.equals(lowercaseServerHostName))
Copy link
Member

Choose a reason for hiding this comment

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

I believe that you can now remove the endsWith(".") check below right? You can simply make serverHostNameValue start with a .. That has two advantages:

  • It would remove the need for you to check !value.equals(lowercaseServerHostName)
  • You can also remove the check on line 103 to ensure the bucket doesn't end with a .

Copy link
Member

@vagaerg vagaerg left a comment

Choose a reason for hiding this comment

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

1 minor comment, LGTM otherwise

@mosiac1 mosiac1 force-pushed the feat/accept-path-on-virtual-host branch from dcdef03 to 2eadbdd Compare August 14, 2024 17:43
@mosiac1 mosiac1 merged commit 4002559 into trinodb:main Aug 14, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants