Search code examples
wordpressiisload-balancing

Wordpress - balanced on 2 servers on IIS - failed to instal new theme


I have Wordpress installed and configured on 2 IIS servers managed by load balancer.

When I uploaded a new theme "essentials", upload went well.

When I try to preview my essentials theme (Appearance -> Themes -> I select "Live preview" on essentials theme) I get error 500. Network request is:

https://xxxx/?customize_changeset_uuid=7a0a2113-ff98-40ba-ae4a-f12fd96c92c7&customize_theme=essentials&customize_messenger_channel=preview-0&customize_autosaved=on

Form data:

_method: GET
wp_customize: on
customize_theme: essentials
nonce: 246d76c7f3
customize_changeset_uuid: 7a0a2113-ff98-40ba-ae4a-f12fd96c92c7
customize_autosaved: on
customized: {"old_sidebars_widgets_data":{"wp_inactive_widgets":[],"sidebar-1":["recent-posts-2"],"sidebar-2":["archives-2","categories-2","meta-2"]},"nav_menu_locations[menu-1]":2}
customize_messenger_channel: preview-0

For example, this is what I get when I click preview of some other valid theme (named twentynineteen)

https://xxxx/?customize_changeset_uuid=e471b84f-c500-4a81-8c0b-d8f49ca62410&customize_theme=twentynineteen&customize_messenger_channel=preview-1&customize_autosaved=on

Form data:

_method: GET
wp_customize: on
customize_theme: twentynineteen
nonce: 4cbd22eb68
customize_changeset_uuid: e471b84f-c500-4a81-8c0b-d8f49ca62410
customize_autosaved: on
customized: {"old_sidebars_widgets_data":{"wp_inactive_widgets":[],"sidebar-1":["recent-posts-2"],"sidebar-2":["archives-2","categories-2","meta-2"]},"nav_menu_locations[menu-1]":2}
customize_messenger_channel: preview-1

I checked out, my essentials theme exists in folder \wp-content\themes on both servers.


Solution

  • I managed to solve it. web.config on the second server was mysteriously missing the rule

    <rule name="xxxx http to https" stopProcessing="true">
     <match url="(.*)" ignoreCase="true" />
     <conditions logicalGrouping="MatchAll">
      <add input="{HTTP_HOST}" pattern="^(www.)?xxxx\.com$" />
      <add input="{HTTPS}" pattern="off" />
      <add input="{URL}" pattern="(.*)" />
     </conditions>
     <action type="Redirect" url="https://xxxx/{R:1}" redirectType="Permanent" />
    </rule>
    

    that was there before. Maybe upgrade or something deleted it.

    xxxx represents my domain