Can not save post with Wordpress on Docker
I am running Wordpress on Docker-Compose with the following docker-compose.yml
:
version: '2'
services:
db_wordpress:
image: mysql:5.7
volumes:
- db_wordpress_data:/var/lib/mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: pwd
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: pwd
wordpress:
image: wordpress:latest
volumes:
- ./wp-content:/var/www/html/wp-content
restart: unless-stopped
expose:
- 80
depends_on:
- db_wordpress
environment:
WORDPRESS_DB_HOST: db_wordpress:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: pwd
WORDPRESS_DEBUG: 1
WORDPRESS_CONFIG_EXTRA: |
// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);
// Disable display of errors and warnings
define('WP_DEBUG_DISPLAY', false);
// Handle subpath /blog
define('WP_HOME','https://www.example.com/blog');
define('WP_SITEURL','https://www.example.com/blog');
$$_SERVER['REQUEST_URI'] = '/blog' . $$_SERVER['REQUEST_URI'];
nginx:
image: nginx
restart: unless-stopped
ports:
- "80:80"
- "443:443"
links:
- wordpress
volumes:
- /var/www/letsencrypt:/var/www/letsencrypt
- ./logs/nginx:/var/log/nginx
- ./nginx.conf:/etc/nginx/nginx.conf
volumes:
db_wordpress_data:
So the wordpress site is behind an nginx
container with the following nginx.conf
file:
events {
worker_connections 1024;
}
http {
upstream wordpress {
server wordpress:80;
}
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server_names_hash_bucket_size 512;
proxy_cache_path /var/cache levels=1:2 keys_zone=STATIC:10m inactive=24h max_size=1g;
server {
listen 80;
server_name example.com;
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 default_server ssl;
server_name example.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
try_files $uri $uri/ =404;
location /blog/ {
proxy_pass http://wordpress/;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}
Now I can access my wordpress admin, install plugins, etc. but when I want to update Posts or Pages, I get a 500
error on the browser, and looking at the logs (docker logs -f clearroad_wordpress_1
):
[Thu Jan 03 17:03:36.105145 2019] [core:error] [pid 97] [client 172.18.0.5:51210] 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://www.example.com/blog/wp-admin/post.php?post=62&action=edit
172.18.0.5 - - [03/Jan/2019:17:03:36 +0000] "POST /wp-json/wp/v2/posts/62/autosaves?_locale=user HTTP/1.0" 500 806 "https://www.example.com/blog/wp-admin/post.php?post=62&action=edit" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko)
So it seems the requests on /blog/wp-json
end up in a redirect loop, what could be the cause?
I checked the .htaccess
file in the wordpress container:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
wordpress docker docker-compose redirect-loop
add a comment |
I am running Wordpress on Docker-Compose with the following docker-compose.yml
:
version: '2'
services:
db_wordpress:
image: mysql:5.7
volumes:
- db_wordpress_data:/var/lib/mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: pwd
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: pwd
wordpress:
image: wordpress:latest
volumes:
- ./wp-content:/var/www/html/wp-content
restart: unless-stopped
expose:
- 80
depends_on:
- db_wordpress
environment:
WORDPRESS_DB_HOST: db_wordpress:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: pwd
WORDPRESS_DEBUG: 1
WORDPRESS_CONFIG_EXTRA: |
// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);
// Disable display of errors and warnings
define('WP_DEBUG_DISPLAY', false);
// Handle subpath /blog
define('WP_HOME','https://www.example.com/blog');
define('WP_SITEURL','https://www.example.com/blog');
$$_SERVER['REQUEST_URI'] = '/blog' . $$_SERVER['REQUEST_URI'];
nginx:
image: nginx
restart: unless-stopped
ports:
- "80:80"
- "443:443"
links:
- wordpress
volumes:
- /var/www/letsencrypt:/var/www/letsencrypt
- ./logs/nginx:/var/log/nginx
- ./nginx.conf:/etc/nginx/nginx.conf
volumes:
db_wordpress_data:
So the wordpress site is behind an nginx
container with the following nginx.conf
file:
events {
worker_connections 1024;
}
http {
upstream wordpress {
server wordpress:80;
}
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server_names_hash_bucket_size 512;
proxy_cache_path /var/cache levels=1:2 keys_zone=STATIC:10m inactive=24h max_size=1g;
server {
listen 80;
server_name example.com;
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 default_server ssl;
server_name example.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
try_files $uri $uri/ =404;
location /blog/ {
proxy_pass http://wordpress/;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}
Now I can access my wordpress admin, install plugins, etc. but when I want to update Posts or Pages, I get a 500
error on the browser, and looking at the logs (docker logs -f clearroad_wordpress_1
):
[Thu Jan 03 17:03:36.105145 2019] [core:error] [pid 97] [client 172.18.0.5:51210] 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://www.example.com/blog/wp-admin/post.php?post=62&action=edit
172.18.0.5 - - [03/Jan/2019:17:03:36 +0000] "POST /wp-json/wp/v2/posts/62/autosaves?_locale=user HTTP/1.0" 500 806 "https://www.example.com/blog/wp-admin/post.php?post=62&action=edit" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko)
So it seems the requests on /blog/wp-json
end up in a redirect loop, what could be the cause?
I checked the .htaccess
file in the wordpress container:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
wordpress docker docker-compose redirect-loop
stackoverflow.com/questions/41701853/…
– PPShein
Jan 7 at 7:45
@PPShein I don't have this error when opening the website but only when trying to update a post or page, so not the same problem. And solution there seems to update apache which I don't use
– Guillaume
Jan 7 at 10:08
I have a similar setup (no Wordpress but a php application) and in my nginx config I don't use upstream but directly the hostname and port ( if needed ). Have you tried to do it in that way? I'm not sure if using the smae name for the upstream and host is a good idea.
– Carlos
Jan 8 at 14:56
@Guillaume in yourdocker-compose.yml' there are
webapp` link tonginx
service, is that already working properly? The solution will be different if there are wordpress only or wordpress + any web apps.
– Dharma Saputra
Jan 9 at 2:15
@DharmaSaputra sorry forgot to remove the line from the file, it's another service I didn't show here but yes everything works fine as I can access the wordpress site, just some post request don't work
– Guillaume
Jan 9 at 7:20
add a comment |
I am running Wordpress on Docker-Compose with the following docker-compose.yml
:
version: '2'
services:
db_wordpress:
image: mysql:5.7
volumes:
- db_wordpress_data:/var/lib/mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: pwd
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: pwd
wordpress:
image: wordpress:latest
volumes:
- ./wp-content:/var/www/html/wp-content
restart: unless-stopped
expose:
- 80
depends_on:
- db_wordpress
environment:
WORDPRESS_DB_HOST: db_wordpress:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: pwd
WORDPRESS_DEBUG: 1
WORDPRESS_CONFIG_EXTRA: |
// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);
// Disable display of errors and warnings
define('WP_DEBUG_DISPLAY', false);
// Handle subpath /blog
define('WP_HOME','https://www.example.com/blog');
define('WP_SITEURL','https://www.example.com/blog');
$$_SERVER['REQUEST_URI'] = '/blog' . $$_SERVER['REQUEST_URI'];
nginx:
image: nginx
restart: unless-stopped
ports:
- "80:80"
- "443:443"
links:
- wordpress
volumes:
- /var/www/letsencrypt:/var/www/letsencrypt
- ./logs/nginx:/var/log/nginx
- ./nginx.conf:/etc/nginx/nginx.conf
volumes:
db_wordpress_data:
So the wordpress site is behind an nginx
container with the following nginx.conf
file:
events {
worker_connections 1024;
}
http {
upstream wordpress {
server wordpress:80;
}
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server_names_hash_bucket_size 512;
proxy_cache_path /var/cache levels=1:2 keys_zone=STATIC:10m inactive=24h max_size=1g;
server {
listen 80;
server_name example.com;
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 default_server ssl;
server_name example.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
try_files $uri $uri/ =404;
location /blog/ {
proxy_pass http://wordpress/;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}
Now I can access my wordpress admin, install plugins, etc. but when I want to update Posts or Pages, I get a 500
error on the browser, and looking at the logs (docker logs -f clearroad_wordpress_1
):
[Thu Jan 03 17:03:36.105145 2019] [core:error] [pid 97] [client 172.18.0.5:51210] 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://www.example.com/blog/wp-admin/post.php?post=62&action=edit
172.18.0.5 - - [03/Jan/2019:17:03:36 +0000] "POST /wp-json/wp/v2/posts/62/autosaves?_locale=user HTTP/1.0" 500 806 "https://www.example.com/blog/wp-admin/post.php?post=62&action=edit" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko)
So it seems the requests on /blog/wp-json
end up in a redirect loop, what could be the cause?
I checked the .htaccess
file in the wordpress container:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
wordpress docker docker-compose redirect-loop
I am running Wordpress on Docker-Compose with the following docker-compose.yml
:
version: '2'
services:
db_wordpress:
image: mysql:5.7
volumes:
- db_wordpress_data:/var/lib/mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: pwd
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: pwd
wordpress:
image: wordpress:latest
volumes:
- ./wp-content:/var/www/html/wp-content
restart: unless-stopped
expose:
- 80
depends_on:
- db_wordpress
environment:
WORDPRESS_DB_HOST: db_wordpress:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: pwd
WORDPRESS_DEBUG: 1
WORDPRESS_CONFIG_EXTRA: |
// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);
// Disable display of errors and warnings
define('WP_DEBUG_DISPLAY', false);
// Handle subpath /blog
define('WP_HOME','https://www.example.com/blog');
define('WP_SITEURL','https://www.example.com/blog');
$$_SERVER['REQUEST_URI'] = '/blog' . $$_SERVER['REQUEST_URI'];
nginx:
image: nginx
restart: unless-stopped
ports:
- "80:80"
- "443:443"
links:
- wordpress
volumes:
- /var/www/letsencrypt:/var/www/letsencrypt
- ./logs/nginx:/var/log/nginx
- ./nginx.conf:/etc/nginx/nginx.conf
volumes:
db_wordpress_data:
So the wordpress site is behind an nginx
container with the following nginx.conf
file:
events {
worker_connections 1024;
}
http {
upstream wordpress {
server wordpress:80;
}
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server_names_hash_bucket_size 512;
proxy_cache_path /var/cache levels=1:2 keys_zone=STATIC:10m inactive=24h max_size=1g;
server {
listen 80;
server_name example.com;
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 default_server ssl;
server_name example.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
try_files $uri $uri/ =404;
location /blog/ {
proxy_pass http://wordpress/;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}
Now I can access my wordpress admin, install plugins, etc. but when I want to update Posts or Pages, I get a 500
error on the browser, and looking at the logs (docker logs -f clearroad_wordpress_1
):
[Thu Jan 03 17:03:36.105145 2019] [core:error] [pid 97] [client 172.18.0.5:51210] 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://www.example.com/blog/wp-admin/post.php?post=62&action=edit
172.18.0.5 - - [03/Jan/2019:17:03:36 +0000] "POST /wp-json/wp/v2/posts/62/autosaves?_locale=user HTTP/1.0" 500 806 "https://www.example.com/blog/wp-admin/post.php?post=62&action=edit" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko)
So it seems the requests on /blog/wp-json
end up in a redirect loop, what could be the cause?
I checked the .htaccess
file in the wordpress container:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
wordpress docker docker-compose redirect-loop
wordpress docker docker-compose redirect-loop
edited Jan 9 at 7:20
Guillaume
asked Jan 3 at 18:24
GuillaumeGuillaume
1,03022143
1,03022143
stackoverflow.com/questions/41701853/…
– PPShein
Jan 7 at 7:45
@PPShein I don't have this error when opening the website but only when trying to update a post or page, so not the same problem. And solution there seems to update apache which I don't use
– Guillaume
Jan 7 at 10:08
I have a similar setup (no Wordpress but a php application) and in my nginx config I don't use upstream but directly the hostname and port ( if needed ). Have you tried to do it in that way? I'm not sure if using the smae name for the upstream and host is a good idea.
– Carlos
Jan 8 at 14:56
@Guillaume in yourdocker-compose.yml' there are
webapp` link tonginx
service, is that already working properly? The solution will be different if there are wordpress only or wordpress + any web apps.
– Dharma Saputra
Jan 9 at 2:15
@DharmaSaputra sorry forgot to remove the line from the file, it's another service I didn't show here but yes everything works fine as I can access the wordpress site, just some post request don't work
– Guillaume
Jan 9 at 7:20
add a comment |
stackoverflow.com/questions/41701853/…
– PPShein
Jan 7 at 7:45
@PPShein I don't have this error when opening the website but only when trying to update a post or page, so not the same problem. And solution there seems to update apache which I don't use
– Guillaume
Jan 7 at 10:08
I have a similar setup (no Wordpress but a php application) and in my nginx config I don't use upstream but directly the hostname and port ( if needed ). Have you tried to do it in that way? I'm not sure if using the smae name for the upstream and host is a good idea.
– Carlos
Jan 8 at 14:56
@Guillaume in yourdocker-compose.yml' there are
webapp` link tonginx
service, is that already working properly? The solution will be different if there are wordpress only or wordpress + any web apps.
– Dharma Saputra
Jan 9 at 2:15
@DharmaSaputra sorry forgot to remove the line from the file, it's another service I didn't show here but yes everything works fine as I can access the wordpress site, just some post request don't work
– Guillaume
Jan 9 at 7:20
stackoverflow.com/questions/41701853/…
– PPShein
Jan 7 at 7:45
stackoverflow.com/questions/41701853/…
– PPShein
Jan 7 at 7:45
@PPShein I don't have this error when opening the website but only when trying to update a post or page, so not the same problem. And solution there seems to update apache which I don't use
– Guillaume
Jan 7 at 10:08
@PPShein I don't have this error when opening the website but only when trying to update a post or page, so not the same problem. And solution there seems to update apache which I don't use
– Guillaume
Jan 7 at 10:08
I have a similar setup (no Wordpress but a php application) and in my nginx config I don't use upstream but directly the hostname and port ( if needed ). Have you tried to do it in that way? I'm not sure if using the smae name for the upstream and host is a good idea.
– Carlos
Jan 8 at 14:56
I have a similar setup (no Wordpress but a php application) and in my nginx config I don't use upstream but directly the hostname and port ( if needed ). Have you tried to do it in that way? I'm not sure if using the smae name for the upstream and host is a good idea.
– Carlos
Jan 8 at 14:56
@Guillaume in your
docker-compose.yml' there are
webapp` link to nginx
service, is that already working properly? The solution will be different if there are wordpress only or wordpress + any web apps.– Dharma Saputra
Jan 9 at 2:15
@Guillaume in your
docker-compose.yml' there are
webapp` link to nginx
service, is that already working properly? The solution will be different if there are wordpress only or wordpress + any web apps.– Dharma Saputra
Jan 9 at 2:15
@DharmaSaputra sorry forgot to remove the line from the file, it's another service I didn't show here but yes everything works fine as I can access the wordpress site, just some post request don't work
– Guillaume
Jan 9 at 7:20
@DharmaSaputra sorry forgot to remove the line from the file, it's another service I didn't show here but yes everything works fine as I can access the wordpress site, just some post request don't work
– Guillaume
Jan 9 at 7:20
add a comment |
2 Answers
2
active
oldest
votes
You are having redirect loop since you proxy to http on Wordpress container, but configured Wordpress to work on https.
for your configuration, please add following to your wp-config.php before the happy blogging line to resolve it:
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) {
$_SERVER['HTTPS'] = 'on';
}
/* That's all, stop editing! Happy blogging. */
add a comment |
.htaccess
should not have effect in your wordpress install because you are using Nginx.
Refer these posts to configure correctly your Nginx instance. There are several recipes depending if you are using HTTPS or not, cache plugins, etc.
- https://codex.wordpress.org/Nginx
- https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54027796%2fcan-not-save-post-with-wordpress-on-docker%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You are having redirect loop since you proxy to http on Wordpress container, but configured Wordpress to work on https.
for your configuration, please add following to your wp-config.php before the happy blogging line to resolve it:
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) {
$_SERVER['HTTPS'] = 'on';
}
/* That's all, stop editing! Happy blogging. */
add a comment |
You are having redirect loop since you proxy to http on Wordpress container, but configured Wordpress to work on https.
for your configuration, please add following to your wp-config.php before the happy blogging line to resolve it:
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) {
$_SERVER['HTTPS'] = 'on';
}
/* That's all, stop editing! Happy blogging. */
add a comment |
You are having redirect loop since you proxy to http on Wordpress container, but configured Wordpress to work on https.
for your configuration, please add following to your wp-config.php before the happy blogging line to resolve it:
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) {
$_SERVER['HTTPS'] = 'on';
}
/* That's all, stop editing! Happy blogging. */
You are having redirect loop since you proxy to http on Wordpress container, but configured Wordpress to work on https.
for your configuration, please add following to your wp-config.php before the happy blogging line to resolve it:
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) {
$_SERVER['HTTPS'] = 'on';
}
/* That's all, stop editing! Happy blogging. */
answered Jan 8 at 15:11
AllenAllen
6,2551219
6,2551219
add a comment |
add a comment |
.htaccess
should not have effect in your wordpress install because you are using Nginx.
Refer these posts to configure correctly your Nginx instance. There are several recipes depending if you are using HTTPS or not, cache plugins, etc.
- https://codex.wordpress.org/Nginx
- https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/
add a comment |
.htaccess
should not have effect in your wordpress install because you are using Nginx.
Refer these posts to configure correctly your Nginx instance. There are several recipes depending if you are using HTTPS or not, cache plugins, etc.
- https://codex.wordpress.org/Nginx
- https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/
add a comment |
.htaccess
should not have effect in your wordpress install because you are using Nginx.
Refer these posts to configure correctly your Nginx instance. There are several recipes depending if you are using HTTPS or not, cache plugins, etc.
- https://codex.wordpress.org/Nginx
- https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/
.htaccess
should not have effect in your wordpress install because you are using Nginx.
Refer these posts to configure correctly your Nginx instance. There are several recipes depending if you are using HTTPS or not, cache plugins, etc.
- https://codex.wordpress.org/Nginx
- https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/
answered Jan 8 at 16:43
LuismiLuismi
516
516
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54027796%2fcan-not-save-post-with-wordpress-on-docker%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
stackoverflow.com/questions/41701853/…
– PPShein
Jan 7 at 7:45
@PPShein I don't have this error when opening the website but only when trying to update a post or page, so not the same problem. And solution there seems to update apache which I don't use
– Guillaume
Jan 7 at 10:08
I have a similar setup (no Wordpress but a php application) and in my nginx config I don't use upstream but directly the hostname and port ( if needed ). Have you tried to do it in that way? I'm not sure if using the smae name for the upstream and host is a good idea.
– Carlos
Jan 8 at 14:56
@Guillaume in your
docker-compose.yml' there are
webapp` link tonginx
service, is that already working properly? The solution will be different if there are wordpress only or wordpress + any web apps.– Dharma Saputra
Jan 9 at 2:15
@DharmaSaputra sorry forgot to remove the line from the file, it's another service I didn't show here but yes everything works fine as I can access the wordpress site, just some post request don't work
– Guillaume
Jan 9 at 7:20