Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1377492 - Serving static files hosted on the master redirects to the projects page
Serving static files hosted on the master redirects to the projects page
Status: CLOSED ERRATA
Product: OpenShift Container Platform
Classification: Red Hat
Component: Management Console (Show other bugs)
3.2.1
Unspecified Unspecified
high Severity high
: ---
: 3.3.1
Assigned To: Samuel Padgett
Yadan Pei
:
Depends On:
Blocks: 1381575
  Show dependency treegraph
 
Reported: 2016-09-19 17:27 EDT by Eric Jones
Modified: 2017-08-22 04:23 EDT (History)
8 users (show)

See Also:
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.
Story Points: ---
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 11:42:01 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2084 normal SHIPPED_LIVE Red Hat OpenShift Container Platform 3.3.1.3 bug fix update 2016-10-27 15:41:25 EDT

  None (edit)
Description Eric Jones 2016-09-19 17:27:33 EDT
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 10:20:43 EDT
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 11:33:23 EDT
3.3.1 fix: https://github.com/openshift/origin-web-console/pull/559
Comment 5 Eric Jones 2016-09-21 10:06:17 EDT
@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 11:33:54 EDT
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 11:53:17 EDT
(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 12:35:09 EDT
> 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 16:14:53 EDT
yapei@redhat.com, can we add a test case for this problem?
Comment 13 Yadan Pei 2016-09-21 20:45:57 EDT
Sure, planned to add, will attach later
Comment 14 Yadan Pei 2016-09-22 01:23:07 EDT
Sorry, Eric

Please ignore my needinfo request
Comment 15 Yadan Pei 2016-09-22 01:25:05 EDT
Hi Samuel, 

Test Case 501623 is updated, step 1- step5 is added to check this issue.
Comment 16 Yadan Pei 2016-09-22 01:25:36 EDT
Could you please take a look?
Comment 17 Samuel Padgett 2016-09-22 08:11:38 EDT
Test case looks good to me, thanks
Comment 19 Yadan Pei 2016-10-08 03:17:54 EDT
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 11:42:01 EDT
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.