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

when i asked request, I got java.lang.UnsupportedOperationException #16085

Closed
daixiaojiang opened this issue Nov 13, 2024 · 5 comments
Closed
Assignees
Labels
for: stackoverflow A question that's better suited to stackoverflow.com

Comments

@daixiaojiang
Copy link

When my interface accesses WebFilterChainProxy , my request cannot be modified. This error is reported to me.

@daixiaojiang daixiaojiang added status: waiting-for-triage An issue we've not yet triaged type: bug A general bug labels Nov 13, 2024
@daixiaojiang
Copy link
Author

java.lang.UnsupportedOperationException: null
at org.springframework.http.ReadOnlyHttpHeaders.put(ReadOnlyHttpHeaders.java:126)
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:

My Spring Security version is 5.8.15, No error is reported when the version is 5.8.11.

@sjohnr
Copy link
Member

sjohnr commented Nov 13, 2024

Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. We prefer to use GitHub issues only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add a minimal sample that reproduces this issue if you feel this is a genuine bug.

Note also that this may be related to spring-projects/spring-framework#33789.

@sjohnr sjohnr closed this as completed Nov 13, 2024
@sjohnr sjohnr self-assigned this Nov 13, 2024
@sjohnr sjohnr added for: stackoverflow A question that's better suited to stackoverflow.com and removed status: waiting-for-triage An issue we've not yet triaged type: bug A general bug labels Nov 13, 2024
@daixiaojiang
Copy link
Author

daixiaojiang commented Nov 14, 2024

Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. We prefer to use GitHub issues only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add a minimal sample that reproduces this issue if you feel this is a genuine bug.

Note also that this may be related to spring-projects/spring-framework#33789.

Because StrictFirewallHttpHeaders is not subclass of ReadOnlyHttpRequestHeaders. You're causing spring incompatibility. That`s a bug.

spring-web org.springframework.http.HttpHeaders#writableHttpHeaders

	public static HttpHeaders writableHttpHeaders(HttpHeaders headers) { 
               Assert.notNull(headers, "HttpHeaders must not be null"); 
               if (headers == EMPTY) { 
                       return new HttpHeaders(); 
               } 
               return (headers instanceof ReadOnlyHttpHeaders ? new HttpHeaders(headers.headers) : headers); 
        } 

spring-security-web org.springframework.security.web.server.firewall.StrictServerWebExchangeFirewall.StrictFirewallServerWebExchange.StrictFirewallHttpRequest#getHeaders

public HttpHeaders getHeaders() { 
     return new StrictServerWebExchangeFirewall.StrictFirewallServerWebExchange.StrictFirewallHttpRequest.StrictFirewallHttpHeaders(super.getHeaders()); 
}

@sjohnr
Copy link
Member

sjohnr commented Nov 14, 2024

My apologies @daixiaojiang, I did not originally realize this was related to spring-projects/spring-framework#33789 and noticed that only after the fact. Please see that issue and this comment. I do not have any other update I can provide on this issue right now, but if I get any more information I will update you on it.

@sjohnr
Copy link
Member

sjohnr commented Nov 14, 2024

@daixiaojiang you may consider using the workaround provided on gh-15974.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: stackoverflow A question that's better suited to stackoverflow.com
Projects
None yet
Development

No branches or pull requests

2 participants