Feature #548

make sunstone location independent (usefull for proxying)

Added by Rolandas Naujikas over 10 years ago. Updated about 5 years ago.

Status:ClosedStart date:03/26/2011
Priority:NormalDue date:
Assignee:Hector Sanjuan% Done:

100%

Category:Sunstone
Target version:Release 3.0
Resolution:fixed Pull request:

Description

I just tried to install and configure sunstone (and opennebula 2.2 RC1 aka 2.1.90) and I found, that it is difficult to put sunstone web gui under some proxy url like https://someserver.org/one/. There many references to root folder in *.html and *.js files and including sunstone-server.rb. I'm attaching a patch for sunstone, which removes as much as possible (found in source files) references to root folder. I tested, it doesn't break direct usage of sunstone and it works through apache 2.2 reverse proxy (mod_proxy_http) with config like "ProxyPass /one/ http://frontend:4567/" "ProxyPassReverse /one/ http://frontend:4567/").

sunstone.patch Magnifier (26.5 KB) Rolandas Naujikas, 03/26/2011 01:41 PM

sunstone-2.2.patch Magnifier (26.9 KB) Rolandas Naujikas, 03/29/2011 07:51 AM

sunstone-master.patch Magnifier - patch for master branch (27.7 KB) Hector Sanjuan, 04/01/2011 02:30 AM

0001-Feature-548-Patch-for-Sunstone-master-3.0.-Tested-wi.patch Magnifier - Patch for master 3.0 branch (33.8 KB) Hector Sanjuan, 06/22/2011 12:25 AM

stunstone_bug_log.txt Magnifier (2.13 KB) Shreyas Parikh, 04/19/2016 03:25 PM

Associated revisions

Revision e778ca2e
Added by Hector Sanjuan about 10 years ago

Feature #548: Patch for Sunstone master 3.0. Tested with reverse proxy

History

#1 Updated by Hector Sanjuan over 10 years ago

  • Category set to Sunstone
  • Assignee set to Hector Sanjuan
  • Target version set to Release 3.0

Hello,

thank you very much for your contribution!. We think it is very useful. I will test it and very probably include it in the mainline soon.

#2 Updated by Rolandas Naujikas over 10 years ago

Updated patch for opennebula-2.2 (only line numbers changed).

#3 Updated by Hector Sanjuan over 10 years ago

Hi, Im testing your proposal on the latest master (sorry, big rearrange of sunstone files because of feature #507).

Everything seems fine except:

diff --git a/src/sunstone/sunstone-server.rb b/src/sunstone/sunstone-server.rb
index 0f8440a..4d38ce1 100755
--- a/src/sunstone/sunstone-server.rb
+++ b/src/sunstone/sunstone-server.rb
@@ -96,7 +96,7 @@ end
 # HTML Requests
 ##############################################################################
 get '/' do
-    redirect '/login' unless authorized?
+    redirect 'login' unless authorized?

     time = Time.now + 60
     response.set_cookie("one-user",

which causes:

[2011-04-01 04:11:22] ERROR URI::InvalidURIError: the scheme http does not accept registry part: hector:9292login (or bad hostname?)
    /home/hector/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/uri/generic.rb:746:in `rescue in merge'
    /home/hector/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/uri/generic.rb:743:in `merge'
    /home/hector/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/webrick/httpresponse.rb:163:in `setup_header'
    /home/hector/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/webrick/httpresponse.rb:101:in `send_response'
    /home/hector/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/webrick/httpserver.rb:86:in `run'
    /home/hector/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'

I will look deeper into this. Meanwhile, I have attached the patch for the current state of master covering all changes i think.

#4 Updated by Rolandas Naujikas over 10 years ago

I tried myself reverse proxy and direct connection - no problems so far. Probably that is a bug in lower level. I'm using Ubuntu 10.04.2 and ruby 1.8.7 for opennebula frontend.

#5 Updated by Hector Sanjuan over 10 years ago

  • % Done changed from 0 to 100

Hi,

tested again, after updating my gems and I see no problem anymore. I will propose that the patch is applied upstream. Thanks again for your contribution!

#6 Updated by Hector Sanjuan about 10 years ago

  • File 0001-Feature-548-Redo-patch-for-master-as-new-things-have.patch added
  • Resolution set to fixed

Adding new patch for master in its current state

#7 Updated by Patrice Lachance about 10 years ago

Hello
Could you please post the reverse proxy configuration you tested with?

#8 Updated by Rolandas Naujikas about 10 years ago

ProxyPass /one/ http://cloud00.mif:3633/
ProxyPassReverse /one/ http://cloud00.mif:3633/

#9 Updated by Patrice Lachance about 10 years ago

Hi, I tested the current master branch with the patch applied and it does not work.

I configured Apache 2.2/mod_proxy with those 2 rules but after the session is established.

After opening "https://public.ip/one/", firefox tries to open "http://public.ip/login" (because there is no session opened).
After manually changing the URL to "https://public.ip/one/login" and signing on, there is another redirection to "http://public.ip/".
The dashboard finaly appears after changing the URL back to "https://public.ip/one/". But no data are displayed, only the "spinning dotted wheels".

So I guess there other rules (mod_rewrite or mod_proxy_html/mod_proxy_http) are required !

#10 Updated by Hector Sanjuan about 10 years ago

Thanks a lot for your feedback, I will have a look. Had not much time to test so far

#11 Updated by Hector Sanjuan about 10 years ago

  • File deleted (0001-Feature-548-Redo-patch-for-master-as-new-things-have.patch)

#12 Updated by Hector Sanjuan about 10 years ago

Ok, I am attaching a new patch. I have got around the problematic redirects, fixed an image path that I had missed and do some testing with Apache.

My proxy configuration is like Rolandas's:

ProxyPass /one/ http://sunstoneserverip:9292/
ProxyPassReverse /one/ http://sunstoneserverip:9292/

No rewrite rules. It is necessary for me to load mod_proxy_http.so though, otherwise Apache complains that

[warn] proxy: No protocol handler was valid for the URL /one/. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.

I have not had time to test all operations, but they should work as login/logout, showing the dashboard etc work well. It would be great to get some feedback to make sure nothing else is broken.

#13 Updated by Patrice Lachance about 10 years ago

Looks good to me, although I haven't tested much neither. Thanks!

#14 Updated by Ruben S. Montero about 10 years ago

  • Status changed from New to Closed
  • Resolution set to fixed

#15 Updated by Shreyas Parikh about 5 years ago

I am facing same issue after upgrade 4.12 to 4.14
- Normal Users and oneadmin user too see spinning logo after login on the sunstone UI.
- sunstone.log file nothing show any error.
- Any idea about the possible solution.
Attached sunstone.log file.

Also available in: Atom PDF