Sub Domain behind Reverse Proxy

So I’m having trouble with having Grav load behind a Reverse Proxy Sub Domain. So I have a reverse proxy set up to look at http://xx.xx.xx.xx/login . So when I visit it loads the site, however it loads it without any assets. Any idea what I need to do to fix that?

Also, when I have the option for Reverse Proxy’s enabled it causes an error to be thrown at me any time I check for updates

Any help would be appreciated.

Hey @hammertime !
Got a very similar problem with sub domains, however I do not know if it has something to do with reverse proxy or not - but my assets does not load for either plugins or themes, but all template files is correct.

First, did you come up with any solution to this issue?
@Sommerregen posted a neat snippet for setup.php in the forum and i’m using it to leverage the subdomains. But still, the assets… Djamil (@w00fz) did take a look but did not see anything…

Eg: when accessing the server looks for - and as that folder does not exist all the assets will break.

So started digging into both the setup.php and htaccess to see if i either htaccess could rewrite the path to root for subdomains - but keep the url intact, or set the $environment in setup.php to not use the sub domain.

Both ways was with no success, probably for the lack of knowledge, now it is just tearing me up. Then saw your post, now feeling like we need this solved so no one will experience this dreadful issue again.

Any help would be appreciated.

so as i really just want to set up a server alias for the subdomain but my hosting provider do not let me touch the apache config or using mod_proxy.

I’m a very stubborn fellow i looted some more and found this htaccess trick that I modified with wildcard for subdomains.

#1.part redirect / to index.php otherwise the rule would be "" nothing
RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com$ [NC]
RewriteCond %{QUERY_STRING} !rew=1 
RewriteCond %{REQUEST_URI} ^/$ 
RewriteRule ^(.*)$ index.php?rew=1 [QSA,L,NE]

#2.part remove / from begin of the request, then silent redirect there
RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com$ [NC]
RewriteCond %{QUERY_STRING} !rew=1 
RewriteCond %{REQUEST_URI} ^/(.*)$ 
RewriteRule ^(.*)$ %1?rew=1 [QSA,L,NE]

This seems to work, but can it somehow be done better?
Maybe a filed issue on this topic?
Or a htaccess guru to improve the snippet and also maybe add it as a optional default in Gravs htaccess?

@jjuii I think @hammertime has a different issue than yours. @hammertime issue is related to Reverse Proxy and is mostly connected with an issue of the Admin plugin.

@hammertime Can you show us the paths you get, when using the Reverse proxy and what are the correct paths? Further can you test this with latest Grav v1.1.0-rc.3 + Grav Admin v1.1.0-rc.4?