Skip to content

wp-admin redirect misses a slash behind apache reverse proxy #641

@Apfelwurm

Description

@Apfelwurm

Hi @ALL,
i have a weird behaviour:

My wordpress container behind an apache reverse proxy is working perfect, the same goes for all the links on the page. When i try to access https://domain.com/wp-admin i get redirected to https://domain.comwp-admin and therefore its not working.
When i access any other link from the page without a trailing slash it gets redirected like it should.
When i try to access https://domain.com/wp-admin/ it works perfectly.

All the issues i could find related to redirection errors were based on the fact that the installations were reachable in a subfolder, which is not the case here.

the compose file looks like:


version: '3.6'

services:
  db:
    image: mysql:5.7
    volumes:
      - /srv/domain/database:/var/lib/mysql
      - /srv/domain/database.sql.gz:/docker-entrypoint-initdb.d/backup.sql.gz
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: PASSWORD
      MYSQL_DATABASE: DATABASE
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: DATABASEPASSWORD

  wordpress:
    image: wordpress:latest
    depends_on:
      - db
    ports:
      - "127.0.0.1:8084:80"
    restart: always
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_NAME: DATABASE
      WORDPRESS_DB_PASSWORD: DATABASEPASSWORD
    volumes:
      - /srv/domain/plugins:/var/www/html/wp-content/plugins
      - /srv/domain/themes:/var/www/html/wp-content/themes
      - /srv/domain/uploads:/var/www/html/wp-content/uploads
      - ./upload.ini:/usr/local/etc/php/conf.d/uploads.ini
  

the apache site config looks like this:

<VirtualHost *:80>
  ServerName domain.com
 Redirect / https://domain.com
</VirtualHost>
<VirtualHost *:443>
  ServerName domain.com

  ProxyPass / http://127.0.0.1:8084/
  ProxyPassReverse / http://127.0.0.1:8084/
  ProxyPreserveHost On
  ProxyAddHeaders On
  RequestHeader set X-Forwarded-Proto "https"

SSLCertificateFile /etc/letsencrypt/live/domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>

can someone point me to my fail here?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionUsability question, not directly related to an error with the image

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions