spring-cloud-openfeign icon indicating copy to clipboard operation
spring-cloud-openfeign copied to clipboard

Enable X-Forwarded Headers.

Open galaxy-sea opened this issue 2 years ago • 5 comments

spring.cloud.loadbalancer.x-forwarded.enabled=true to Enable X-Forwarded Headers.

galaxy-sea avatar Sep 07 '22 05:09 galaxy-sea

Codecov Report

Merging #748 (787e386) into main (666a59d) will increase coverage by 0.62%. The diff coverage is 88.23%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #748      +/-   ##
============================================
+ Coverage     78.48%   79.11%   +0.62%     
+ Complexity      549      543       -6     
============================================
  Files            66       66              
  Lines          2045     2030      -15     
  Branches        281      276       -5     
============================================
+ Hits           1605     1606       +1     
+ Misses          282      264      -18     
- Partials        158      160       +2     
Impacted Files Coverage Δ
...ign/loadbalancer/XForwardedHeadersTransformer.java 87.50% <87.50%> (ø)
...adbalancer/FeignLoadBalancerAutoConfiguration.java 100.00% <100.00%> (ø)
...gframework/cloud/openfeign/support/FeignUtils.java 80.00% <0.00%> (-6.67%) :arrow_down:
...amework/cloud/openfeign/FeignClientsRegistrar.java 76.92% <0.00%> (-1.93%) :arrow_down:
...enfeign/annotation/QueryMapParameterProcessor.java 87.50% <0.00%> (-1.39%) :arrow_down:
...amework/cloud/openfeign/support/SpringEncoder.java 84.14% <0.00%> (-0.74%) :arrow_down:
...mework/cloud/openfeign/FeignAutoConfiguration.java 90.14% <0.00%> (-0.14%) :arrow_down:
...gframework/cloud/openfeign/FeignClientBuilder.java 84.37% <0.00%> (ø)
...ork/cloud/openfeign/DefaultFeignLoggerFactory.java 100.00% <0.00%> (ø)
...eign/annotation/CookieValueParameterProcessor.java 94.11% <0.00%> (ø)
... and 5 more

codecov[bot] avatar Sep 07 '22 05:09 codecov[bot]

Can you please explain why this is needed? Feign isn't a proxy

spencergibb avatar Sep 07 '22 10:09 spencergibb

hello @spencergibb , RestTemplate migrates to OpenFeign. RestTemplate provides org.springframework.cloud.loadbalancer.blocking.XForwardedHeadersTransforme, but OpenFeign does not provide XForwardedHeadersTransformer

galaxy-sea avatar Sep 07 '22 10:09 galaxy-sea

Refer to RestTemplate and WebClient .

Check Set 'X-Forwarded-*' header when using loadbalanced RestTemplate issus, Don't know why OpenFeign doesn't provide support

@spencergibb

galaxy-sea avatar Sep 08 '22 05:09 galaxy-sea

hello @spencergibb , Please consider merging this PR

galaxy-sea avatar Sep 12 '22 11:09 galaxy-sea

hello @OlgaMaciaszek , I have updated the document,

galaxy-sea avatar Oct 18 '22 05:10 galaxy-sea

I think these documents should be placed in Spring Cloud Commons

galaxy-sea avatar Oct 18 '22 05:10 galaxy-sea

@galaxy-sea it is already documented there. But it's good to reiterate here, since we add the code separately (there's no full parity between the OF LB client and the Commons LB clients).

OlgaMaciaszek avatar Oct 18 '22 11:10 OlgaMaciaszek

@galaxy-sea it is already documented there. But it's good to reiterate here, since we add the code separately (there's no full parity between the OF LB client and the Commons LB clients).

@OlgaMaciaszek, Thank you for unlocking my doubts

galaxy-sea avatar Oct 18 '22 12:10 galaxy-sea