- 
                Notifications
    
You must be signed in to change notification settings  - Fork 5k
 
Generate URI of token service via Host in request #21898
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
Conversation
          Codecov ReportAll modified and coverable lines are covered by tests ✅ 
 Additional details and impacted files@@            Coverage Diff             @@
##             main   #21898      +/-   ##
==========================================
+ Coverage   45.36%   46.44%   +1.07%     
==========================================
  Files         244      253       +9     
  Lines       13333    14236     +903     
  Branches     2719     2925     +206     
==========================================
+ Hits         6049     6612     +563     
- Misses       6983     7273     +290     
- Partials      301      351      +50     
 Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
  | 
    
86624aa    to
    53d00ee      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the token service URL generation to prioritize the Host header from the HTTP request, enabling Harbor clients to interact with the service using either hostnames or IP addresses.
- Renamed the function from tokenSvcEndpoint to tokenSvcURL to better reflect its purpose
 - Introduced a helper function (getURL) to format the token service URL
 - Modified the URL generation logic to utilize req.Host when available
 
18b88c7    to
    0dae104      
    Compare
  
    This commit update the flow to generate URL of token service, which will first try to use the Host in request. This will help the situation when Harbor is configured to serve via a hostname but some client needs to pull artifacts from Harbor via IP due to limitations in the environment. Signed-off-by: Daniel Jiang <[email protected]>
0dae104    to
    d335e89      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This commit update the flow to generate URL of token service, which will first try to use the Host in request. This will help the situation when Harbor is configured to serve via a hostname but some client needs to pull artifacts from Harbor via IP due to limitations in the environment. Signed-off-by: Daniel Jiang <[email protected]>
| 
           While upgrading from v2.13.1 to v2.14.0, we ran into an issue that might be useful to others Our harbor is hosted on  Which caused Harbor to reply with the internal cluster  I will blame this on a misconfiguration on our end, but just in case someone else faces the same, I hope this helps figure it out quicker.  | 
    
This commit update the flow to generate URL of token service, which will first try to use the Host in request. This will help the situation when Harbor is configured to serve via a hostname but some client needs to pull artifacts from Harbor via IP due to limitations in the environment. Signed-off-by: Daniel Jiang <[email protected]>
This commit update the flow to generate URL of token service, which will first try to use the Host in request. This will help the situation when Harbor is configured to serve via a hostname but some client needs to pull artifacts from Harbor via IP due to limitations in the environment.
Please indicate you've done the following: