spring-cloud / spring-cloud-dataflow-ui

This repo provides the Dashboard application of Spring Cloud Data Flow
https://dataflow.spring.io/
Apache License 2.0
214 stars 118 forks source link

fix: reverse proxy url fix #1995

Closed klopfdreh closed 2 months ago

klopfdreh commented 7 months ago

UI accessed over reverse-proxy: http://reverse-proxy-url:443/scdf/ Actual backend url: http://somedomain.de:8080/scdf/

If you access _links the actual backend is rendering those as http://somedomain.de:8080/scdf/tasks/logs/mytask?platformName=default&schemaTarget=boot2

This PR is going to exchange the protocol / host / port from the one of the reverse proxy so that it is going to look like this http://reverse-proxy-url:443/scdf/tasks/logs/mytask?platformName=default&schemaTarget=boot2

So somedomain.de is replaced with reverse-proxy-url, 8080 is replaced with 443 and http with http

If the server does not run behind a reverse proxy nothing is going to be changed - for the tests I wrapped the url into a try catch as there is no protocol / domain / port present.

Edit: fixes: https://github.com/spring-cloud/spring-cloud-dataflow-ui/issues/1994

klopfdreh commented 7 months ago

Hint: As there are no other places which use _links from backend this change should be fine. If there are other occurrences the new function can be used there as well.

klopfdreh commented 7 months ago

Hey @claudiahub / @oodamien - what do you think about that fix? We recently tested it and it works behind reverse proxy and direct access without changes to the backend.

klopfdreh commented 6 months ago

Hey @claudiahub - @onobc just asked me if I could provide an opt-in setting for the reverse proxy fix which can be activate through the settings page. I force pushed the changes to this PR. Here is how the ui looks like, now:

Bildschirmfoto 2024-05-15 um 23 59 24

The default behavior is deactivated. Can you check if everything is working for you properly?

klopfdreh commented 3 months ago

@cppwfs / @corneil - any chance to get this into 2.11.5?

onobc commented 2 months ago

Thanks for the contribution @klopfdreh !

Closing via https://github.com/spring-cloud/spring-cloud-dataflow-ui/commit/f0f082035623bf91702d57f24b93adc012716b93