Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have Webmin configured to listen on localhost:1000 and nginx configured to listen on my.domain.tld:80 with reverse proxy pointing to Webmin. This configuration works fine but sometimes I get 404 errors and HTTP headers say that this is Webmin's miniserv puts 302 redirects into them:

HTTP/1.0 302 Moved Temporarily Date: Sun, 3 Jan 2010 11:38:46 GMT Server: MiniServ/0.01 Connection: close Location: http://my.domain.tld:10000/webmin/

Can you advice on how to disable this behavior?

share|improve this question

3 Answers 3

up vote 2 down vote accepted

I had a very similar problem. However, my problem was specifically that after you login to Webmin, it would redirect to the non-proxied address and port.

To further illustrate, assume I wanted webmin to appear to the outside post-proxy on 'https://example.com/admin/webmin', but it's really running on 'https://example.com:10000'. Going to the first address would display the login page, but redirect me to the second address (302 Moved Permanently). I could then type or paste the first address, and all would work as though I was logged in.

I tried following the directions on the Webmin wiki, your suggestion above, and various other suggestions. Then I found the solution. I needed to add another ProxyReversePass to my Apache configuration, to catch the URL in the redirect.

ProxyRequests Off
ProxyPreserveHost On
SSLProxyEngine On

ProxyPass /admin/webmin/ https://example.com:10000/
ProxyHTMLURLMap https://localhost:10000 /admin/webmin

<Location /admin/webmin/>
 ProxyHTMLExtended On
 SetOutputFilter proxy-html
 ProxyPassReverse https://localhost:10000/
 ProxyPassReverse https://example.com:10000/
</Location>

Of course, in /etc/webmin/config I have webprefix="/admin/webmin" and webprefixnoredir=1. I wanted SSL protection over my local LAN, so I left it SSL enabled and did the SSL proxy thing. Hope this helps as a possible solution to anyone experiencing this issue.

I was so desperate I was trying to modify miniserv.pl and even thought about breaking out mod_rewrite.

share|improve this answer

Okay, I figured it out myself. When you configure Webmin to bind to localhost only you should use the following command in miniserv.conf:

sockets=127.0.0.1:10000

This is insted of host=localhost and port=1000. I hope it will help someone else too.

share|improve this answer

Thanks, the sockets option almost got me there, but I’m using SSL on the front end (which handles certificates better) and I’m coming in on a different port on the front end, so I also needed to add:

proxy_redirect http://www.example.com:10000 https://www.example.com:10443;
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.