Question

Request exceeded the limit of 10 internal redirects due to probable configuration error while having WordPress behind a reverse-proxy

What I want to do:

ps: I used the marketplace WordPress to create the droplet

I tried a lot of different things but in the end I couldn’t get through this error that appears when I try to access a blog post:

[Tue Mar 30 21:46:24.047355 2021] [ssl:info] [pid 818] [client 54.89.204.173:53088] AH01964: Connection to child 2 established (server blog.domain.com:443)
[Tue Mar 30 21:46:24.047582 2021] [ssl:debug] [pid 818] ssl_engine_kernel.c(2372): [client 54.89.204.173:53088] AH02043: SSL virtual host for servername blog.domain.com found
[Tue Mar 30 21:46:24.057128 2021] [ssl:debug] [pid 818] ssl_engine_kernel.c(2254): [client 54.89.204.173:53088] AH02041: Protocol: TLSv1.3, Cipher: TLS_AES_256_GCM_SHA384 (256/256 bits)
[Tue Mar 30 21:46:24.057250 2021] [socache_shmcb:debug] [pid 818] mod_socache_shmcb.c(493): AH00831: socache_shmcb_store (0x73 -> subcache 19)
[Tue Mar 30 21:46:24.057258 2021] [socache_shmcb:debug] [pid 818] mod_socache_shmcb.c(847): AH00847: insert happened at idx=4, data=(867:899)
[Tue Mar 30 21:46:24.057262 2021] [socache_shmcb:debug] [pid 818] mod_socache_shmcb.c(850): AH00848: finished insert, subcache: idx_pos/idx_used=0/5, data_pos/data_used=0/1084
[Tue Mar 30 21:46:24.057265 2021] [socache_shmcb:debug] [pid 818] mod_socache_shmcb.c(515): AH00834: leaving socache_shmcb_store successfully
[Tue Mar 30 21:46:24.057371 2021] [socache_shmcb:debug] [pid 818] mod_socache_shmcb.c(493): AH00831: socache_shmcb_store (0xde -> subcache 30)
[Tue Mar 30 21:46:24.057388 2021] [socache_shmcb:debug] [pid 818] mod_socache_shmcb.c(847): AH00847: insert happened at idx=8, data=(1742:1774)
[Tue Mar 30 21:46:24.057391 2021] [socache_shmcb:debug] [pid 818] mod_socache_shmcb.c(850): AH00848: finished insert, subcache: idx_pos/idx_used=0/9, data_pos/data_used=0/1958
[Tue Mar 30 21:46:24.057394 2021] [socache_shmcb:debug] [pid 818] mod_socache_shmcb.c(515): AH00834: leaving socache_shmcb_store successfully
[Tue Mar 30 21:46:24.057482 2021] [ssl:debug] [pid 818] ssl_engine_kernel.c(415): [client 54.89.204.173:53088] AH02034: Initial (No.1) HTTPS request received for child 2 (server blog.domain.com:443), referer: https://domain.com/blog/
[Tue Mar 30 21:46:24.057636 2021] [authz_core:debug] [pid 818] mod_authz_core.c(817): [client 54.89.204.173:53088] AH01626: authorization result of Require all granted: granted, referer: https://domain.com/blog/
[Tue Mar 30 21:46:24.057645 2021] [authz_core:debug] [pid 818] mod_authz_core.c(817): [client 54.89.204.173:53088] AH01626: authorization result of <RequireAny>: granted, referer: https://domain.com/blog/
[Tue Mar 30 21:46:24.057879 2021] [core:error] [pid 818] [client 54.89.204.173:53088] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: https://domain.com/blog/
[Tue Mar 30 21:46:24.057885 2021] [core:debug] [pid 818] core.c(3832): [client 54.89.204.173:53088] AH00121: r->uri = /blog/index.php, referer: https://domain.com/blog/
[Tue Mar 30 21:46:24.057888 2021] [core:debug] [pid 818] core.c(3838): [client 54.89.204.173:53088] AH00122: redirected from r->uri = /blog/index.php, referer: https://domain.com/blog/
[Tue Mar 30 21:46:24.057891 2021] [core:debug] [pid 818] core.c(3838): [client 54.89.204.173:53088] AH00122: redirected from r->uri = /blog/index.php, referer: https://domain.com/blog/
[Tue Mar 30 21:46:24.057894 2021] [core:debug] [pid 818] core.c(3838): [client 54.89.204.173:53088] AH00122: redirected from r->uri = /blog/index.php, referer: https://domain.com/blog/
[Tue Mar 30 21:46:24.057896 2021] [core:debug] [pid 818] core.c(3838): [client 54.89.204.173:53088] AH00122: redirected from r->uri = /blog/index.php, referer: https://domain.com/blog/
[Tue Mar 30 21:46:24.057899 2021] [core:debug] [pid 818] core.c(3838): [client 54.89.204.173:53088] AH00122: redirected from r->uri = /blog/index.php, referer: https://domain.com/blog/
[Tue Mar 30 21:46:24.057902 2021] [core:debug] [pid 818] core.c(3838): [client 54.89.204.173:53088] AH00122: redirected from r->uri = /blog/index.php, referer: https://domain.com/blog/
[Tue Mar 30 21:46:24.057904 2021] [core:debug] [pid 818] core.c(3838): [client 54.89.204.173:53088] AH00122: redirected from r->uri = /blog/index.php, referer: https://domain.com/blog/
[Tue Mar 30 21:46:24.057907 2021] [core:debug] [pid 818] core.c(3838): [client 54.89.204.173:53088] AH00122: redirected from r->uri = /blog/index.php, referer: https://domain.com/blog/
[Tue Mar 30 21:46:24.057911 2021] [core:debug] [pid 818] core.c(3838): [client 54.89.204.173:53088] AH00122: redirected from r->uri = /blog/index.php, referer: https://domain.com/blog/
[Tue Mar 30 21:46:24.057917 2021] [core:debug] [pid 818] core.c(3838): [client 54.89.204.173:53088] AH00122: redirected from r->uri = /hello-world/, referer: https://domain.com/blog/
[Tue Mar 30 21:46:24.058076 2021] [ssl:debug] [pid 818] ssl_engine_io.c(1102): [client 54.89.204.173:53088] AH02001: Connection closed to child 2 with standard shutdown (server blog.domain.com:443)

I can access the login page, wp-admin, and /blog fine though.

Here is what I’m using and their settings

I’m using rack-reverse-proxy gem on the rails app:

config.middleware.insert(0, Rack::ReverseProxy) do
  reverse_proxy_options preserve_host: true
  reverse_proxy /^\/blog(\/.*)$/, 'https://domain.com$1'
end

On WordPress general settings I have “https://domain.com/blog” on both WordPress address and Site address fields.

My .htaccess is the one created by WordPress:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>

Virtual host in /etc/apache2/sites-enabled/000-default.conf:

UseCanonicalName On

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        ServerName blog.domain.com
        ServerAlias www.blog.domain.com

        DocumentRoot /var/www/html

        <Directory /var/www/html/>
            Options FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.blog.domain.com [OR]
RewriteCond %{SERVER_NAME} =blog.domain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

More clues

Something that might be a clue: when I access domain.com/blog/wp-admin without being logged in, it redirects me to https://domain.com/blog/wp-login.php?redirect_to=https%3A%2F%2Fblog.domain.com%2Fwp-admin%2F&reauth=1. And I have no idea where this blog.domain.com domain comes from.

I have the blog.domain.com subdomain added to the WordPress droplet.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer