Bug 1377492 - Serving static files hosted on the master redirects to the projects page
Summary: Serving static files hosted on the master redirects to the projects page
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Management Console
Version: 3.2.1
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 3.3.1
Assignee: Samuel Padgett
QA Contact: Yadan Pei
URL:
Whiteboard:
Depends On:
Blocks: 1381575
TreeView+ depends on / blocked
 
Reported: 2016-09-19 21:27 UTC by Eric Jones
Modified: 2019-12-16 06:49 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: The download CLI link from the web console would not work if the CLI download was hosted as a web console extension. Consequence: You could not host the download as a web console extension. Fix: Fix the download link so that it will always download from the server. Result: You can host the CLI as a static file using web console extensions.
Clone Of:
: 1381575 (view as bug list)
Environment:
> openshift version openshift v3.2.1.13-1-gc2a90e1 kubernetes v1.2.0-36-g4a3f9c5 etcd 2.2.5
Last Closed: 2016-10-27 15:42:01 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2084 0 normal SHIPPED_LIVE Red Hat OpenShift Container Platform 3.3.1.3 bug fix update 2016-10-27 19:41:25 UTC

Description Eric Jones 2016-09-19 21:27:33 UTC
Description of problem:
The documentation [0] indicates that you can serve static files from the master directly into the console. It also indicates that you can change where the users download the CLI tools.

If you provide a link in the cli downloads page to download a static hosted file you get redirected back to the projects page. 

[0] https://docs.openshift.com/enterprise/3.2/install_config/web_console_customization.html#serving-static-files
[1] https://docs.openshift.com/enterprise/3.2/install_config/web_console_customization.html#adding-or-changing-links-to-download-the-cli

Version-Release number of selected component (if applicable):


How reproducible:
100%

Steps to Reproduce:
1. mkdir /root/teststuff
2. for x in 1 2 3 ; do echo $x > /root/teststuff/$x.txt ; done
3. cat my.js
     window.OPENSHIFT_CONSTANTS.CLI = {
       "Mac OS X":        "https://masterthing.novalocal:8443/console/extensions/downloads/2.txt"
     };
cat /etc/origin/master/master-config.yaml
  ...
  assetConfig:
    extensionScripts:
    - /root/my.js
    extensions:
      - name: downloads
        sourceDirectory: /root/teststuff
  ...

4. systemctl restart atomic-openshift-master

In web browser:
5. visit OpenShift Cluster Hostname
6. click "?" dropdown
7. click "Command Line Tools"
8. click "Mac OS X"


Actual results:
Redirected back to projects page

Expected results:
Visit webpage with static file (either to download or see, not clear what should happen at that point)

Additional info:
Attaching shortly screenshots from environment as well as HAR file generated by Firefox after right-clicking and selecting "Inspect Element", changing to "Network" and doing the last portion of the reproducer steps(from "In web browser" on).

Comment 2 Samuel Padgett 2016-09-20 14:20:43 UTC
The extensions are working. The problem is the Angular router is trying to handle the link as an internal app link rather than loading the page from the server.

Comment 4 Samuel Padgett 2016-09-20 15:33:23 UTC
3.3.1 fix: https://github.com/openshift/origin-web-console/pull/559

Comment 5 Eric Jones 2016-09-21 14:06:17 UTC
@Samuel, is there a way to workaround that for now?

I currently have a customer using 3.2.X that is running into this issue

Comment 6 Samuel Padgett 2016-09-21 15:33:54 UTC
Eric, unfortunately I don't think there's a workaround other than to put the download on a different host rather than using an extension. To make the download work as an extension requires this fix.

Comment 7 Eric Jones 2016-09-21 15:53:17 UTC
(In reply to Samuel Padgett from comment #2)
> The extensions are working. The problem is the Angular router is trying to
> handle the link as an internal app link rather than loading the page from
> the server.

So essentially, I can setup the extension (which works properly), I cannot host any file for download. 

This fix you added will only work for the CLI downloads, from what I was able to see. How does this fix get added for the generic extension that any admin can setup?

What information does a user (and therefore the docs) need to setup a functional download after this fix?

Comment 8 Samuel Padgett 2016-09-21 16:35:09 UTC
> So essentially, I can setup the extension (which works properly), I cannot host any file for download. 

No, the download itself works fine. It's a problem with the CLI download _link_ in the web console specifically. Since the host and "/console" context match the web console's, AngularJS is handling it as an internal application link and not making a request to the server for the content. If you right click and open the CLI download link in a new window, or just paste the link into a blank browser window, the download should work.

> What information does a user (and therefore the docs) need to setup a functional download after this fix?

There's no change to how you would set up the download. The instructions in the bug description will work with this fix.

Comment 12 Samuel Padgett 2016-09-21 20:14:53 UTC
yapei, can we add a test case for this problem?

Comment 13 Yadan Pei 2016-09-22 00:45:57 UTC
Sure, planned to add, will attach later

Comment 14 Yadan Pei 2016-09-22 05:23:07 UTC
Sorry, Eric

Please ignore my needinfo request

Comment 15 Yadan Pei 2016-09-22 05:25:05 UTC
Hi Samuel, 

Test Case 501623 is updated, step 1- step5 is added to check this issue.

Comment 16 Yadan Pei 2016-09-22 05:25:36 UTC
Could you please take a look?

Comment 17 Samuel Padgett 2016-09-22 12:11:38 UTC
Test case looks good to me, thanks

Comment 19 Yadan Pei 2016-10-08 07:17:54 UTC
Checked against 
openshift v3.3.1.1
kubernetes v1.3.0+52492b4
etcd 2.3.0+git


with steps:

1. Prepare the static files and CLI download link files

# mkdir /root/testfiles

# echo 1 > /root/testfiles/1.txt

# cat /root/cli-links.js

window.OPENSHIFT_CONSTANTS.CLI = {
  "Mac OS X":        "https://<master>:8443/console/extensions/downloads/1.txt"
};

 

2. Modify your master-config.yaml

assetConfig:
  extensionScripts:
  - /root/cli-links.js
  extensions:
    - name: downloads
      sourceDirectory: /root/testfiles

3. Restart atomic-openshift-master

# systemctl restart atomic-openshift-master

 

4. Logout -> Login web console again

 

5. click "?" dropdown

click "Command Line Tools"

click "Mac OS X"


6. Number 1 is returned on page


Now it returns the correct content of static files, move to VERIFIED

Comment 21 errata-xmlrpc 2016-10-27 15:42:01 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:2084


Note You need to log in before you can comment on or make changes to this bug.