[ 
https://issues.apache.org/jira/browse/MESOS-5911?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15396170#comment-15396170
 ] 

Greg Mann edited comment on MESOS-5911 at 7/27/16 7:07 PM:
-----------------------------------------------------------

[~mlunoe] yep that makes sense. We perform the client-side redirection 
[here|https://github.com/apache/mesos/blob/6d63c6236cec99a6ff79afd690c2287ccf3063eb/src/webui/master/static/js/controllers.js#L62-L82].

Instead of performing the redirect client-side, we can do it immediately in the 
master. This would require that we alter the way that libprocess serves static 
assets. Since this is libprocess-level code, knowledge of the master's state 
isn't in scope and we can't inspect the master's leader status. I see a couple 
options:

1) Pass an object into libprocess that will allow it to detect whether or not a 
given path should be redirected
2) Expose the libprocess static assets to Mesos so that they can be served via 
an application-level handler, in which we could check the master's leader status

[~anandmazumdar] also brought up the good point that this still leaves the edge 
case of leader election *while* an operator is actively using the UI. In this 
case, perhaps we could provide a UI dialog with a button that allows the user 
to easily make a request for the web UI from the leading master.

Thoughts?


was (Author: greggomann):
[~mlunoe] yep that makes sense. We perform the client-side redirection 
[here|https://github.com/apache/mesos/blob/6d63c6236cec99a6ff79afd690c2287ccf3063eb/src/webui/master/static/js/controllers.js#L62-L82].

Instead of performing the redirect client-side, we can do it immediately in the 
master. This would require that we alter the way that libprocess serves static 
assets. Since this is libprocess-level code, knowledge of the master's state 
isn't in scope and we can't inspect the master's leader status. I see a couple 
options:

1) Pass an object into libprocess that will allow it to detect whether or not a 
given path should be redirected
2) Expose the libprocess static assets to Mesos so that they can be served via 
an application-level handler, in which we could check the master's leader status

Anand also brought up the good point that this still leaves the edge case of 
leader election *while* an operator is actively using the UI. In this case, 
perhaps we could provide a UI dialog with a button that allows the user to 
easily make a request for the web UI from the leading master.

Thoughts?

> Webui redirection to leader in browser does not work
> ----------------------------------------------------
>
>                 Key: MESOS-5911
>                 URL: https://issues.apache.org/jira/browse/MESOS-5911
>             Project: Mesos
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Jacob Janco
>            Assignee: haosdent
>            Priority: Blocker
>              Labels: webui
>         Attachments: http_redirect.gif
>
>
> We deployed 1.0.0-rc4 in a small test cluster with 3 masters/5 agents. 
> Redirection to master curling for state.json returned the expected 307, 
> however, in browser (chrome/safari/firefox), redirection failed with: 
> {code}
> XMLHttpRequest cannot load <master_url_1>:5050/master/state. No 
> 'Access-Control-Allow-Origin' header is present on the requested resource. 
> Origin '<master_url_2>:5050' is therefore not allowed access.
> {code}
> This is the patch that introduced the redirect on /state (and HTTP calls): 
> https://reviews.apache.org/r/34646
> The issue is that before this change, the server side does not redirect, the 
> web UI controller.js decides from the content of the state.json which leader 
> to redirect and then invoke redirection itself. Browsers allow this but not 
> the server side initiated redirect without 'Access-Control-Allow-Origin' 
> header?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to