-
Notifications
You must be signed in to change notification settings - Fork 6k
PortResolverImpl will resolve to 8080 if request port is 8443 #4160
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
Comments
This issue will also happen on 5.1, and will also happen in reverse (setting HTTPS to port 8080 will resolve to 8443) see also: spring-projects/spring-boot#6140 assuming the behavior has to remain the same, a log warning/error would be very much appreciated when this workaround is encountered. |
The problem is if we log a warning and the user is running http on port 8443, then we are logging an invalid warning. Do you have a proposal that does not cause invalid logging to happen? Otherwise, this is really just a matter of the user needing to configure things correctly. |
by my understanding, running HTTPS on 8080 (or HTTP on 8443, for @nucatus ) is not currently possible. I'll admit to being relatively new to Spring Security, though. To clarify a bit, the configuration that led me here was: application-local.properties:
which caused the loginPage redirection to go to port 8443. Changing to |
Did you try providing your own mapping. For example: @Override
protected void configure(HttpSecurity http) throws Exception {
http
// ....
.portMapper()
// the HTTP port of 9443 maps to the HTTPS port of 8080
.http(9443).mapsTo(8080)
// the HTTP port of 80 maps to the HTTPS port of 443
.http(80).mapsTo(443);
} |
to clarify a bit - in this case we would need to add guardrails like this for the person provisioning the server:
is that correct? |
Rather than warning you would just look up the ports and map them:
|
however, our user in this case did not specify that we could use port 8443, and we'd like to minimize impact to ports other than the one the user has specified. Admittedly my example messages could use some improvement (mentioning which additional port has been claimed and why) |
Closing this since Spring Security has no idea what your HTTP Port or HTTPS Ports are. Users must configure this themselves. |
Summary
The PortResolverImpl.java will resolve to 8080 in case you run http on 8443, thus resulting in wrong behavior.
Since this implementation is a specific fix for a IE bug, I guess all the logic should be conditioned by the presence of the IE user-agent header. Otherwise, no translation is necessary.
Actual Behavior
As described above.
Expected Behavior
The port should remain the same, even if you run http over 8443 (8443 is not a standard port for https in the first place, maybe just a convention, but not explicitly defined as such)
Configuration
Standard Spring security implementation
Version
4.1.3
The text was updated successfully, but these errors were encountered: