noi-techpark / odh-mentor-otp

4 stars 8 forks source link

Strange call to docker causes crash of client app #20

Closed bertolla closed 3 years ago

bertolla commented 3 years ago

For some strange reason the client app crashes after doing some strange call to docker02.testingmachine.eu. I guess there is something to configure on the otp app to avoid this. This happens only in chrome for me, but the wrong call is also been done on other browsers. strangecall

rcavaliere commented 3 years ago

@zabuTNT and @stemove can you please have a look at this? Do you have an idea about the problem causing this?

zabuTNT commented 3 years ago

@stemove I think that the issue is here in the index, cause the redirect from the home page.

https://github.com/noi-techpark/odh-mentor-otp/blob/development/otp-app/app/lib/index.tpl.html#L63

//CHECK CURRENT PATH
    if(location.pathname.split('/')[1] !== userlang) {
      location.href = '/'+userlang;
    }

Maybe this create a loop because the homepage is like that: https://journey.opendatahub.testingmachine.eu/#/ and try to become /#/it

so in order to work I think that we have to change the redirect like that:

location.href = "it/"

this should redirect to /it/#/.... if you go directly to /it or /en the problem doesn't occour. https://journey.opendatahub.testingmachine.eu/it/#/ https://journey.opendatahub.testingmachine.eu/en/#/

bertolla commented 3 years ago

Thanks for the input. Currently I used this workaround https://github.com/noi-techpark/odh-mentor-otp/commit/a72d942b32dea802a3eb075caabf79ab975cc0d7 but to me it seems a nginx issue which does an unwanted redirect. Maybe there is some configuration we could make but I wouldn't know about it.

ghost commented 3 years ago

hi @bertolla

I am investigating the possible cause of the problem, but the main problem is that I can't replicate the bug in local in any way (even changing my hostname)

but to me it seems a nginx issue which does an unwanted redirect.

I also had thought of a similar thing but in reality the nginx configuration is very simple and used simply to provide resources on all the resources required without any redirects:

docker exec openmove-otp-journey cat /etc/nginx/sites-enabled/default
server {
    listen 80 default_server;
    listen [::]:80 default_server;
    root /var/www/html;
    index index.html index.htm index.nginx-debian.html;
    server_name _;
    location / {
        try_files $uri $uri/ =404;
    }
}

the modification suggested by @zabuTNT should partially solve the problem, but investigating the code I discovered that it could be caused by the presence of old code in the configuration by mistake.

I ask you kindly to do a quick test in your online instance with this simple change: https://github.com/openmove/odh-mentor-otp/commit/548c20acdf384508fa5db6f7e19a1fa73ea657d2 after that, rebuild the journey docker image

if it works I have already introduced this fix in our fork and I can send you a new PR