WordPress hosted behind a proxy and different subdomain – Cannot update or create pages/Redirect Loop

[ad_1]

Hi,

I work at a small company and we’re currently setting up a application dashboard for accessing our internally used services and providing a Single-Sign On where possible. Because most open source “Dashboard-Only” solutions didn’t work out for us I ended up building a very simple (first time ever touching WordPress) dashboard that is used to redirect users to other services.

​

The server running WordPress is located at [service.example.org]) and WordPress resides in the /dashboard subdirectory (so [service.example.org/dashboard]) to access the dashboard).

We use a reverse proxy at [proxy.example.org]) to access our services ([proxy.example.org/service1]), [proxy.example.org/service2]), …). I was setting up and configuring WordPress using [service.example.org]) and everything worked perfectly fine. Later, we used the proxy to access the dashboard and while the dashboard page works fine without any issues, trying to update the page in the admin settings displays a “Failed to Update, you are probably offline” message. Opening the browser console shows a massive list of CORS errors. The reason is that, while the browser accesses WordPress through [proxy.example.org/dashboard]), those XHR-Requests are sent to [service.example.org/dashboard]).

My guess is that this is caused by the Site Url and WordPress Url Settings.

The Setting are:

* WordPress URL: [**https://proxy.example.org/dashboard**])
* Site URL: [**https://service.example.org/dashboard**])

If I set both to [https://proxy.example.org/dashboard]), I enter a redirect loop and if I switch the URLs accessing [service.example.org/dashboard]) shows the admin page (you get redirected after logging in through [proxy.example.org](https://proxy.example.org)) but navigating to the dashboard using either url causes a redirect loop (unless you explicitly append /wp-admin to the url)

If anyone knows what’s going or how to fix this so that accessing it through [proxy.example.org/dashboard]) works without issues they’d be my personal heroes.

​

Some Setup information:

[**service.example.org**])

* Apache2
* Php8.1-fpm

[**proxy.example.org**])

* nginx

​

location /dashboard {
proxy_pass ;
}

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer