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: improve redirect to allow url rewrite #969

Merged
merged 2 commits into from
Dec 31, 2021

Conversation

momiji
Copy link
Contributor

@momiji momiji commented Dec 30, 2021

Signed-off-by: momiji [email protected]

Improve redirect usage to allow rewriting url in direct and proxy mode.

Description

When redirect contains a /, it is considered as an rewrite url instead of a hostname replacement.
Rewrite is similar to apache ProxyPass directive everybody is used to.

Related Issue

#959

Motivation and Context

With full url rewrite, it is now possible to completely change url and not only hostname.
It also applies to direct mode when useProxies is set, allowing to serve multiple (registry) mirrors based on the url.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist:

  • Code compiles correctly.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@momiji momiji requested a review from a team as a code owner December 30, 2021 23:24
@codecov-commenter
Copy link

codecov-commenter commented Dec 30, 2021

Codecov Report

Merging #969 (dfee2f7) into main (5ba34ad) will increase coverage by 0.16%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #969      +/-   ##
==========================================
+ Coverage   42.29%   42.46%   +0.16%     
==========================================
  Files         116      116              
  Lines        8788     8796       +8     
==========================================
+ Hits         3717     3735      +18     
+ Misses       4607     4597      -10     
  Partials      464      464              
Flag Coverage Δ
Object-compatibility-e2etests ?
e2etests ?
unittests 42.46% <66.66%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
client/daemon/proxy/proxy.go 9.93% <66.66%> (+1.43%) ⬆️
client/daemon/peer/peertask_base.go 47.11% <0.00%> (+1.15%) ⬆️
client/daemon/peer/peertask_stream.go 54.48% <0.00%> (+1.54%) ⬆️
client/daemon/peer/peertask_stream_callback.go 64.07% <0.00%> (+1.94%) ⬆️

Copy link
Member

@jim3ma jim3ma left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@gaius-qi gaius-qi left a comment

Choose a reason for hiding this comment

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

LGTM

@gaius-qi gaius-qi merged commit 35a005e into dragonflyoss:main Dec 31, 2021
gaius-qi pushed a commit that referenced this pull request Jun 28, 2023
* feat: improve redirect to allow url rewrite

Signed-off-by: momiji <[email protected]>
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.

4 participants