Issue accessing Wordpress dashboard behind traefik

Hey everyone,

I have a simple setup where a Wordpress and its dependencies are served in a container behind Traefik. The problem is I can't access the admin dashboard and I'm prompted with "not allowed to access this page" error. This issue doesn't occur when bypassing Traefik and accessing the container directly.

Here is my compose file:

version: '3.5'

services:

# ------------------------ Jetware LEMP ---------------------------- #

  jetware-wordpress-4:
    image: jetware/wordpress-4
    build: .
    networks:
      - traefik
    expose:
      - 80
    labels:
      - traefik.wordpress.frontend.rule=Host:wordpress.domain.com
      - traefik.wordpress.passHostHeader=true
      - traefik.wordpress.port=80
    volumes:
      - jetware-persistent-data:/jet/prs
      - ./app:/jet/app
    container_name: jetware-wordpress-4

...

Hey @yassine.laz,

That is because of a little missmatch in your compose file.

You're trying to hit your wordpress with the url wordpress.comain.com, but you tell Traefik to proxy it on domain.com

You would have to change the label traefik.wordpress.frontend.rule=Host:domain.com to
traefik.wordpress.frontend.rule=Host:wordpress.domain.com

I made an error while writing the post and I rectified it.
The frontend was indeed wordpress.domain.com. If it was not, I wont be able to access wp-login and put credentials in the first place (It was after that that i was denied access).

Alright this was solved by forcing wordpress to SSL
Added this at the top of wp-config :

$_SERVER['HTTPS'] = 'on';
define('FORCE_SSL_ADMIN', true);
1 Like

Glad it's solved :slight_smile: Sorry for not comming back to you yesterday. Glad its done!

1 Like