-
Notifications
You must be signed in to change notification settings - Fork 191
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
fix: return url without port if default port protocol is used #1511
fix: return url without port if default port protocol is used #1511
Conversation
Can one of the admins verify this patch? |
840a44e
to
312498f
Compare
Not sure about that. Now, if I have configured 8080 for http port and no request port you'll return no port - i.e. 80.
or
help for proper resolution? |
It seems to work because all test in PropertyBasedArtifactUrlHandlerTest.java passed ? Also this isn't a configuration issue hawkbit should be able to generate correct url without changing the configuration. For exemple I could have different proxy with different port at the same time. I change AbstractDDiApiIntegrationTest#HTTP_LOCALHOST because MockMvcRequestBuilders create a fake server with default http port so it should not return url with 8080 port. |
By default, hawkbit server is plain http on 8080. That's why it shall, by default, add this port into the download URL. |
Thz class AbstractDDiApiIntegrationTest is about hawkbit test without proxy. So without proxy, port in artifact url should be equal to hawkbit port. Then if hawkbit run on port 80, artifact url shoukd use port 80. In my understanding the mock MockMvcRequestBuilders emulate a server on port 80. |
The current DEFAULT port in scope of hawkBit is 8080. Each application could define such default port. Of course the local / development purposes configuration often differ from one for particular environment. |
@strailov This PR isn't about changing default Hawkbit port it's about generating correct url when hawkbit is behind an https proxy on port 443. @avgustinmm They were two solutions to fix integration tests:
Solution 1 seems simpler to me because it was just about changing one line. |
dad12d6
to
63cab59
Compare
@flobz,
|
I totally agree, we should not change default behavior and I think that my change don't do that . This test https://github.com/eclipse/hawkbit/blob/28f0446d9d835979c7bc7759ae0a75e82c5514e5/hawkbit-core/src/test/java/org/eclipse/hawkbit/api/PropertyBasedArtifactUrlHandlerTest.java#L71 seems to verify the scenario you describe, and it still pass with my changes.
The class PropertyBasedArtifactUrlHandler has a parameter called "portRequest": Here is a table to show what this PR change really:
So to sum up this PR :
|
63cab59
to
beaed0a
Compare
aha, we will check. If
then I suppose the PR is ok |
@flobz, thanks for the contribution. |
I fixed the copyright issue. 😊. You want me to update the copyright to 2024? |
I'd propose to make the first line "Copyright (c) 2024 Contributors to the Eclipse Foundation" |
beaed0a
to
2730245
Compare
@avgustinmm it's done. |
@flobz, thanks for the contribution |
When using Hawkbit behind a proxy wrong port is returned for downloading artifacts if default port protcol is used(eg: 443 for https).
If no port is specified hawkbit return hawkbit port not protocol default port:
https://anotherhost.com:8080/DEFAULT/controller/v1/xxxxxx/softwaremodules/X/artifacts/*
Instead of
https://anotherhost.com/DEFAULT/controller/v1/xxxxxx/softwaremodules/X/artifacts/*