webmin / authentic-theme

Official theme for the best server management panel of the 21st Century
https://authentic-theme.com
MIT License
947 stars 163 forks source link

Image links broken when proxied through apache - Authentic theme v 12 #165

Closed KDocProf closed 9 years ago

KDocProf commented 9 years ago

Hi,

I run Webmin behind an apapche proxy so that I can access like this:

https://myrealdomain.com/webmin

As soon as I upgraded to version 12 of authentic-theme, All of the image links were broken

As an example. On the Webmin configuration page, all of the image source links are coming up as:

src="/images/modules/webmin/.... 

instead of:

src="/webmin/images/modules/webmin/.... 

This same problem applies everywhere I've looked so far. As another example, on the System Information page, the pie charts are missing.

iliajie commented 9 years ago

Hmm. I see. Can you please open DevTools in Chrome/Firefox (F12) and debug on right page <body> tag. What is the data-webprefix value there?

KDocProf commented 9 years ago

Hi and Thanks for responding! Here's the body tag from inside the iframe on the right (with the information page highlighted in the debugger):

<body data-webprefix="/webmin" data-current-product="webmin">
iliajie commented 9 years ago

I have hard time reproducing it. Can you provide more info/screenshots with DevTools pannel open so I could understand? Do you run Webmin using minserv or apache?

KDocProf commented 9 years ago

HI Again,

I am running Webmin using miniserv and then accessing through an Apache Reverse Proxy.

Here is the relevant piece of the Apache config (and yes, the obligatory config statements are in place in the ssl.conf file to enable proxying https):

ProxyRequests Off

<Location "/webmin/">
    ProxyPass https://127.0.0.1:10000/
    ProxyPassReverse https://127.0.0.1:10000/
</Location>

<Proxy *>
    allow from all
</Proxy>

I also have these two lines in /etc/webmin/config:

webminprefixnoredir=1
webprefix=/webmin

Here are two screenshots that show what is happening since I upgraded to Authentic-theme v 12:

webmin_sysinfo

webmin_configuration

I hope this helps!

Thank You

iliajie commented 9 years ago

That is enough information to have tondebug it for me, I guess.

OK, I will take a closer look when I get to my PC but so far can you change webprefix= to null value and restart Webmin?

Are you doing it to have no port settings in URL? Doing so makes your Webmin dependent on Apache web-server which is not very good, I think?

iliajie commented 9 years ago

...ahh, ok. I think my recommendation wouldn't help. I think I know what is happening.. Will contact you later.

brandom commented 9 years ago

Shouldn't image links be relative?

/images/modules/webmin/advanced.gif
images/modules/webmin/advanced.gif 
iliajie commented 9 years ago

No, I redirect all links to my theme to manage images.

iliajie commented 9 years ago

I will make end extension to try to load images from module's dir for backward compatibility.

brandom commented 9 years ago

Yeah, you're right. I forgot I could just test it in Chrome dev tools. Relative does not work either with my similar setup using a nginx proxy and serving under a subdirectory.

iliajie commented 9 years ago

I know why it's not working. Please join authentic theme room, I will be there in about 3 hours.

authentic-theme@conference.jabbers.im

You can register free jabber XMPP account at jabbers.im.

iliajie commented 9 years ago

Please be kind testing it with updated js:

https://rostovtsev.ru/pub/src/authentic/12.00-patches/issue165/default.min.js

It's practically from new release (will be ready in few days) but it should fix your issue.

If problem persists, clear browser's cache and restart Webmin. Even more click refresh button in System Information Page.

Then, if still there is a problem, try adding trailing slash, so make a webprefix=/webmin/ and then see.

When it works, try also testing now only charts at the screen but autocomplete (in search bar) features and all possible other things, while at the same time looking at the console for possible errors.

I did all of the work theoretically without a chance to test it in real situation (it's harmless but might not work).

Waiting for your soon reply.

Thanks!

brandom commented 9 years ago

The js above does fix the broken charts, however reloading sysinfo and packages still does not work. I was able to fix it but I don't want to submit a PR for that because the change was made in the minified source.

If you would like to add the unminified source js and css files to the repo I can submit a PR to add a build process using gulp to produce a single js and css file to speed up the load time.

iliajie commented 9 years ago

Does autocomple work? Does Virtualmin links work? Back button works in Webmin?

I think I know why it doesn't work.. I will not be able to add unminified version because it's almost the same as minified for the only difference that it has funky comments that only I can read :) I think I will add just formatted minified version later, so people could just submit some code.

However if you don't mind posting some changes that you've done and those that work, just post few lines here - I will get it.

Thanks! ;)

brandom commented 9 years ago

I don't use Virtualmin to test it, but back button and autocomplete is working.

Minified code is really hard to hack on and the diffs aren't very useful. Funky comments are fine! A build process would make it a lot easier for others to get involved, but if you aren't looking for PRs on the core code that's fine too.

As for my changes to default.min.js I followed your lead and tracked down the rest of the instances of

('iframe[name="page"]').attr("src",window.parent.$__source_host_complete+$webprefix+

and replaced it with

('iframe[name="page"]').attr("src",$webprefix_full+`

and it fixed the remaining issues I mentioned above.

iliajie commented 9 years ago

Yes, that's the thing, I guess! I will test it in the morning. For me, there is no difference really when reading beautified minified version and not properly commented src. Probably, one day, when I have time, I will make src ready for others but just not right now!

Thank you!!

brandom commented 9 years ago

Awesome! I look forward to it. Great theme, keep up the good work. I look forward to v13.

iliajie commented 9 years ago

Guys, it was a nightmare to make things work together, meaning Server Indexes module and Proxy stuff.

Now everything should be working!??!? Could you please be kind checking?? https://rostovtsev.ru/pub/src/authentic/12.00-patches/issue165/2/default.min.js

Please click all over, refresh sysinfo couple of times, use autocomplete and etc.

Thanks for your help!!

Waiting for your test results!

brandom commented 9 years ago

Everything looks good on Webmin. I have a subdomain proxy installation at home and a subdir installation at work. Both have been tested with this latest js.

iliajie commented 9 years ago

Awesome! So good to hear, it worked!! :+1: Thanks, pal! Keep in touch in Authentic Room.If you have interesting feature requests, you could discuss it there!

brandom commented 9 years ago

How do I access it? http://jabbers.im/ just gives me "Hellow World."

iliajie commented 9 years ago

Which OS you using as desktop?

brandom commented 9 years ago

OS X Yosemite

iliajie commented 9 years ago

I see. iOS has inbuilt messenger. Start it, add XMPP (Jabber) account, enter an id, like brandom@jabbers.im, choose yourself a password and tick a box to create new account on server. - You're done. 20 seconds deal! Then, join a room on authentic-theme@conference.jabbers.im. Same could be done on the phone. If you use Android, the best is Conversations https://play.google.com/store/apps/details?id=eu.siacs.conversations&hl=en

brandom commented 9 years ago

There is no option to create a new account in iMessages. I went to https://register.jabber.org/ which has "temporarily disabled" account registration since June 2013 and wants me to go to https://xmpp.net/ which is only a server directory. Why not use something more straight forward like IRC?

iliajie commented 9 years ago

It's more secure to use XMPP, probably just hitting go, should create new account, unless those iMessenger developers are completely ..., well you know. Pidgin - is a great one.

KDocProf commented 9 years ago

If you are using Mac OS X, than install "Adium" and create the account from within Adium. That worked for me.

iliajie commented 9 years ago

It will be fully fixed in version 13. Thanks for reporting!