Wordpress behind reverse proxy admin issues

admin

Administrator
Staff member
basically as title says i got a wp behind reverse proxy.
Let's say, the domain is <strong><em>, and wordpress is *</em>***</strong>/blog
Here are the wp-config.php edits that allow it to work this way:

Code:
define('.ADMIN_COOKIE_PATH.', '/blog');
define('.COOKIE_DOMAIN.', 'www.***.com');
define('.COOKIEPATH.', '/blog');
define('.SITECOOKIEPATH.', '.');


if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $list = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
        $_SERVER['REMOTE_ADDR'] = $list[0];
  }
define('DOMAIN_CURRENT_SITE', 'https://www.***.com/blog');
define('WP_HOME','https://www.***.com/blog');
define('WP_SITEURL','https://www.***.com/blog');
$_SERVER['REMOTE_ADDR'] = 'https://www.***.com/blog';
$_SERVER['HTTP_HOST'] = 'www.***.com/blog';
$_SERVER[ 'SERVER_ADDR' ] = 'www.***.com/blog';


define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL_LOGIN', true);
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
       $_SERVER['HTTPS']='on';

$_SERVER['REQUEST_URI'] = str_replace("https://www.***.com/wp-admin",
                                      "https://www.***.com/blog/wp-admin",
                                      $_SERVER['REQUEST_URI']);

Now, it all works perfectly, but when I m in some places in admin panel, lets say comments, if i submit forms, WP goes to <strong><em>*</em></strong>/wp-admin instead of <strong><em>*</em></strong>/blog/wp-admin and crashes to 404.

<strong>UPDATE</strong>

tried the VHost approach, added this to my httpd.conf

Code:
Listen 80 &lt;VirtualHost *:80&gt; 
  DocumentRoot /var/www/wp-admin 
  ServerName https://***/blog/wp-admin 

# Other directives here 
&lt;/VirtualHost&gt;

but strangely got a redirect loop whenever i go to /blog after this

How do I fix this?