• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Apache2 Reverse Proxy Rewrite help

smdion

Limp Gawd
Joined
May 30, 2003
Messages
447
Right now I have my unraid server behind my proxy so I only have port 80 open to the world. The downfall is my unraid is a www.domain.com/main, www.domain.com/shares and so on. I want to move it to www.domain.com/unraid/main and www.domain.com/unraid/shares. I have dug through the man pages but my knowledge on rewrite is lacking to decipher them.


Current snippet from default.

Code:
<Location /Main>
        ProxyPass http://IPADDRESS:8008/Main
        ProxyPassReverse http://IPADDRESS:8008/Main
</Location>

I have rewriteengine on at the beginning of my default file.
 
Last edited:
It's not really a rewrite thing. Are you sure you have mod_proxy installed and active?
 
I do have mod proxy installed. It works great at the domain.com/main I just want it to work at domain.com/unraid/main
 
I am not sure why you are specifying a location of '/Main' then. You should be specifying '/unraid'

Code:
<Location /unraid/Main>
        ProxyPass http://IPADDRESS:8008/Main
        ProxyPassReverse http://IPADDRESS:8008/Main
</Location>
 
Code:
<Location /unraid>
        ProxyPass http://IPADDRESS:8008/
        ProxyPassReverse http://IPADDRESS:8008/
</Location>
<Location /Main>
        ProxyPass http://IPADDRESS:8008/Main
        ProxyPassReverse http://IPADDRESS:8008/Main
</Location>
<Location /plugins>
        ProxyPass http://IPADDRESS:8008/plugins
        ProxyPassReverse http://IPADDRESS:8008/plugins
</Location>
<Location /Shares>
        ProxyPass http://IPADDRESS:8008/Shares
        ProxyPassReverse http://IPADDRESS:8008/Shares
</Location>
<Location /Users>
        ProxyPass http://IPADDRESS:8008/Users
        ProxyPassReverse http://IPADDRESS:8008/Users
</Location>
<Location /Settings>
        ProxyPass http://IPADDRESS:8008/Settings
        ProxyPassReverse http://IPADDRESS:8008/Settings
</Location>
<Location /Utils>
        ProxyPass http://IPADDRESS:8008/Utils
        ProxyPassReverse http://IPADDRESS:8008/Utils
</Location>
<Location /Health>
        ProxyPass http://IPADDRESS:8008/Health
        ProxyPassReverse http://IPADDRESS:8008/Health
</Location>
<Location /Stats>
        ProxyPass http://IPADDRESS:8008/Stats
        ProxyPassReverse http://IPADDRESS:8008/Stats
</Location>

Is the full default for that site, but the links are hard coded to go to domain.com/main or domain.com/health. I want the proxy when it sees domain.com/main to rewrite it to domain.com/unraid/main
 
Ok, so the only proxy entry you should need is the '/unraid' one.

Code:
<Location /unraid>
        ProxyPass http://IPADDRESS:8008/
        ProxyPassReverse http://IPADDRESS:8008/
</Location>

The proxy code is just making an alias of '/unraid', so the '/unraid' path goes to your internal server. All other paths of /unraid/Main, /unraid/Shares, etc should now be valid paths.

Now you just need mod_rewrite to handle the hard coded paths for you. You may be able to do this with Apache's 'Alias', but I am not sure. Here is the typical code from an .htaccess.

Code:
Options +FollowSymLinks
RewriteEngine On
ReWriteRule ^/Main/(.*)$ /unraid/Main/$1 [R,L]

I haven't tested it, but it may give you a starting place. Another option may be to use the 'Redirect' option.

Code:
Redirect 301 /Main /unraid/Main

But you are correct, the documentation for several of these items isn't the best, so I have found that I tend to play with things for a while until I get it to work properly.
 
Thanks for the help. One last question. I also have ProxyPasses for other services running on different IPs/Ports in the same default document. How to I put in the rewrite without having it effect those?
 
May I suggest using mod_proxy_html instead of mod_rewrite? It should be better suited for this situation
 
Thanks!

I ended up using a combination of both


Code:
        ProxyPass http://10.10.10.11:8008/Shares
        ProxyPassReverse http://10.10.10.11:8008/Shares

        Redirect 301 /Shares /unraid/Shares

        # Ouput html from proxy filter
        SetOutputFilter proxy-html

        # Overwrite html, exchange urls with proxied ones
        ProxyHTMLExtended On
        ProxyHTMLURLMap http://www.domain.com/unraid/Shares  http://10.10.10.10.11:8008/Shares
 
Last edited:
OK. Part 2 of this request.

My unraid server has a file at 10.10.10.11:8008/update.htm that passes thru all the commands to restart server, change anything, etc...

So its requesting thru domain.com/update.htm. I don't want to pass all root files thru to 10.10.10.11. Is there a proxy command that I can say when www.domain.com/update.htm is requested pass thru to 10.10.10.11:8008/update.htm?
 
Back
Top