Post Preview not working behind Proxy (3 posts)

  1. bceo
    Posted 4 years ago #

    Hi all,

    I´ve got a Problem with the post/page preview in WordPress.

    The Serve-Configuration is as follow:

    The WordPress address is set to sub2.example.com (IP:,
    and the site URL is set to sub1.example.com (IP:

    Both IPs directs to the same server, for each IP there is an own Apache-Instance running.

    If a Client requests the site sub1.example.com, this "server" requests the wordpress site from sub2.example.com, transforms the output and finally send the transformed output to the requesting client:

    +--------+      +------------------+       +------------------+
    |        | ---> | sub1.example.com | --->  | sub2.example.com |
    | CLIENT |      |                  |       |                  |
    |        | <--- | IP    | <---  | IP:   |
    +--------+      +------------------+       +------------------+
                      Transforms the                WordPress
                      WordPress output

    This works as it should, but now comes my problem:

    The WordPress admin area is accessible via sub2.example.com/wordpress/wp-admin.
    When I edit a post or a page and click on PREVIEW, I get redirected, for example, to http://sub1.example.com/hello-world/?preview=true&preview_id=1&preview_nonce=1234567890.
    And this redirect fails: "You do not have the necessary rights to see the preview".

    (If I call http://sub2.example.com/hello-world/?preview=true&preview_id=1&preview_nonce=1234567890 it works pretty fine, but i need to call sub1.example.com ...)

    First i thought that this is a Problem with the WordPress authentication cookie, so i installed the Root Cookie Plugin. The cookie, wich is set for sub1.example.com contains :

    • name: wordpress_logged_in_919292837291837382927,
      value: admin%8289328%9324789347843789,
      Domain: .example.com,
      path: /
    • name: wordpress_919292837291837382927,
      value: admin%82893289324%789347843789,
      Domain: .example.com,
      path: /

    But this didn´t solve my Problem, I still get the same error.

    Some other attempts i´ve tried:

    • Setup sub1.example.com as Proxy Server:
      define('WP_PROXY_HOST', '');
      define('WP_PROXY_PORT', '80');
      define('WP_PROXY_USERNAME', '');
      define('WP_PROXY_PASSWORD', '');
      define('WP_PROXY_BYPASS_HOSTS', 'localhost');

    But this also did not work.

    I hope you understand my problem and maybe someone has an idea how to solve this?

    Thanks in advanced and sorry for my bad english (this is not my native language :) )

    (I also posted this question at http://wordpress.stackexchange.com and http://stackoverflow.com)

  2. TCBarrett
    Posted 4 years ago #

    I'm not familiar with the root cookie plugin, but you could try setting it in wp-config.php

  3. bceo
    Posted 4 years ago #

    Thanks for your reply.

    I´ve tried to set up the cookies in wp-config as you mentioned, but the problem still exists (the Root Cookie Plugin creates the same Cookie as if I define it in wp-config).

    BTW: I get an 500 Internal Server error...

    Maybe its cause by the different IP-Adresses?

Topic Closed

This topic has been closed to new replies.

About this Topic