nazar-pc / docker-phpmyadmin

phpMyAdmin as Docker container, based on official image, always latest version
40 stars 16 forks source link

Bad redirection after login #11

Closed yomguy closed 8 years ago

yomguy commented 8 years ago

Hi, First, thanks for your work! I have a bad redirection after login, for example:

http://phpmyadmin/index.php?token=7cf8cf2463be23991bae7c3f1c0e2a9c

like the domain is missed.

nazar-pc commented 8 years ago

Can you provide some more details about your configuration? I mean which webservers used before phpmyadmin and configs of related virtual hosts?

yomguy commented 8 years ago

Sure. Here is the adding in my composition: https://github.com/Parisson/Telemeta/blob/dev/docker-compose.yml#L91

and the related nginx config: https://github.com/Parisson/Telemeta/blob/dev/app/deploy/nginx-app.conf#L23

yomguy commented 8 years ago

oh, as I'm writing to you, I realize that the form is redirecting to the docker composition subdomain, not the main one which does proxying. Maybe I need some more nginx header parameters..

nazar-pc commented 8 years ago

Yes, try to do it like this:

location /phpmyadmin {
               proxy_pass http://phpmyadmin/;
               proxy_set_header Host $host;
}
nazar-pc commented 8 years ago

Also #10 seems to be related here

yomguy commented 8 years ago

yes, better because it gets the domain, but not the relative subpath (/phpmyadmin/) I'm afraid.

yomguy commented 8 years ago

then do you think it's possible to get the phpmyadmin config as a volume and assign PmaAbsoluteUri ?

nazar-pc commented 8 years ago

I've just pushed significant update, try this now: https://github.com/nazar-pc/docker-phpmyadmin#custom-uri-of-phpmyadmin-instance But I didn't get why you might need a volume here (though, there should be no problems with it).

yomguy commented 8 years ago

Great ! pulling...

yomguy commented 8 years ago

OK, thanks ! Working nice giving the absolute URI in the composition. However, I would prefer to not specify any external domain in the generic composition so that the app can start from any host (like we want for any web application). Don't you think PMA could detect its own $host and relative URI during login ? I know this is about out of the scope, but I'm surprised PMA cannot behaves well behind any relative path.

yomguy commented 8 years ago

My surprise is also due to the fact that after login, everything is OK for PMA...

nazar-pc commented 8 years ago

I guess you have to look at source code and probably post an issue in phpMyAdmin repository. Generally, specifying right headers in Nginx vhost should make phpMyAdmin happy, but I'm not familiar with details under the hood, didn't need that yet.

yomguy commented 8 years ago

I understand your point of view and really appreciate your help. BTW don't you think it could be induced by the Apache config of the container ? I've indeed already seen or use a working PMA instance behind a complex URI ;)

nazar-pc commented 8 years ago

I'm pretty sure this is just a matter of right config. But including any changes in this repo means that it should be general-purpose.

yomguy commented 8 years ago

I've just checked the last config I use which was driven by php-fpm behind nginx... nothing comparable to your setup but working:

   location /phpmyadmin {
        root /usr/share/;
        index index.php index.html index.htm;

        location ~ ^/phpmyadmin/(.+\.php)$ {
            try_files $uri =404;
            root /usr/share/;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include /etc/nginx/fastcgi_params;
        }

        location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
            root /usr/share/;
        }
    }

    location /phpMyAdmin {
        rewrite ^/* /phpmyadmin last;
    }
yomguy commented 8 years ago

Of course I agree with the "general-purpose" of this repo ;)

nazar-pc commented 8 years ago

There are some ideas (though, not for Nginx) in wiki: https://wiki.phpmyadmin.net/pma/Config/PmaAbsoluteUri

yomguy commented 8 years ago

I can't have it work the generic way for the moment after trying various nginx configs (with various proxy_set_header and proxy_cookie_path values) but without success. I think there is something to do between your apache and my nginx to get the right redirection. But, as it works well using your later ABSOLUTE_URI option - even it offer a non generic solution - and as I can also use a separate port for PMA - which works well - I can close this issue. I will ping you again when I find a better solution around the configs... Thanks for helping ! Cheers, Guillaume