Skip to content

vtctld: proxy must update target URLs#6062

Merged
sougou merged 3 commits intovitessio:masterfrom
planetscale:ss-fix-vtctld-proxy
Apr 14, 2020
Merged

vtctld: proxy must update target URLs#6062
sougou merged 3 commits intovitessio:masterfrom
planetscale:ss-fix-vtctld-proxy

Conversation

@sougou
Copy link
Copy Markdown
Contributor

@sougou sougou commented Apr 13, 2020

VTTablet URLs can change. If so, the reverse proxy should update
its redirects.

Signed-off-by: Sugu Sougoumarane ssougou@gmail.com

VTTablet URLs can change. If so, the reverse proxy should update
its redirects.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
@sougou sougou requested a review from enisoc April 13, 2020 20:06
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
@sougou sougou force-pushed the ss-fix-vtctld-proxy branch from 143c1f7 to 451fb64 Compare April 13, 2020 20:58
}
return nil
}
r.URL.Path = "/" + splits[3]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should do this in a Director function since ReverseProxy requires one anyway. I'm guessing you haven't tested this rewrite yet since it should panic in its current form...

Also, for what it's worth, ReverseProxy makes a deep copy of the Request before letting you modify it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What use case would cause this to panic? It worked fine when I tested this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh you're right. I was mistaken. I was thinking about a case when I previously had tried to set Director = nil explicitly since I wanted a no-op Director.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Copy link
Copy Markdown
Contributor Author

@sougou sougou left a comment

Choose a reason for hiding this comment

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

Resurrected the Director.

For posterity, this is not a perfect implementation. If the content contains those specific patterns, they'll get blindly substituted. It's something we'll have eventually address.

}
return nil
}
r.URL.Path = "/" + splits[3]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What use case would cause this to panic? It worked fine when I tested this.

Copy link
Copy Markdown
Member

@enisoc enisoc left a comment

Choose a reason for hiding this comment

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

LGTM

@sougou sougou merged commit 0e74446 into vitessio:master Apr 14, 2020
@enisoc enisoc deleted the ss-fix-vtctld-proxy branch April 14, 2020 21:56
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

Successfully merging this pull request may close these issues.

2 participants