Git Product home page Git Product logo

Comments (11)

delfer avatar delfer commented on July 24, 2024 6

@TimWolla it is still an issue

from docker-adminer.

TimWolla avatar TimWolla commented on July 24, 2024 2

@vesamet You misconfigured your proxy_pass directive. Quoting from the nginx documentation (http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass):

If the proxy_pass directive is specified with a URI, then when a request is passed to the server, the part of a normalized request URI matching the location is replaced by a URI specified in the directive:

Replacing proxy_pass http://XX.XX.XX.X:3000/; with proxy_pass http://XX.XX.XX.X:3000; should fix the issue for you.

from docker-adminer.

vesamet avatar vesamet commented on July 24, 2024 1

This config works fine for me :

location /adminer {
        proxy_pass  http://localhost:3000;
        proxy_set_header    Host                $http_host;
        proxy_set_header    X-Real-IP           $remote_addr;
        proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
    }

But it doesn't work if pointing to another server like this

location /adminer {
        proxy_set_header X-Forwarded-Host $host:$server_port;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://XX.XX.XX.X:3000/;
    }

It points to domain root like this: https://example.com/?server=localhost&username=username
@TimWolla Do you know a possible fix ? I tried the fastcgi method but it's not working as expected.
Thank you in advance if you happen to have the time!

from docker-adminer.

TimWolla avatar TimWolla commented on July 24, 2024

Is it possible to use a sub-url path instead of only "/" root URL ?

It is. For more specific advice I need to know which image you are using (FastCGI or Standalone?, Which Reverse Proxy or Webserver?).

from docker-adminer.

konvergence avatar konvergence commented on July 24, 2024

Standalone

from docker-adminer.

TimWolla avatar TimWolla commented on July 24, 2024

Use a reverse proxy of your choice to map an arbitrary path to the /index.php of the container.

from docker-adminer.

jalogisch avatar jalogisch commented on July 24, 2024

@TimWolla maybe I'm to stupid, but the following did not work for me:

The Part of my docker_compose.yml


  adminer:
    image: adminer
    container_name: adminer
    hostname: adminer
    mem_limit: 128m
    restart: always
    environment:
      - TZ=Europe/Berlin
    ports:
      - 127.0.0.1:8082:8080
    depends_on:
      - db

The part of my NGINX configuration

  location /adminer/ {
    proxy_set_header Host $host;
    proxy_redirect off;
    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;
    proxy_pass http://127.0.0.1:8082/;
  }

but the above will not let me login, as after login the page is redirected to / removing the subfolder.

Maybe you can document this a little more.

thx

from docker-adminer.

TimWolla avatar TimWolla commented on July 24, 2024

@jalogisch I can confirm that adminer generates an absolute redirect, instead of a relative one. I don't think you are able to configure an explicit folder in adminer, thus: Use fastcgi mode which supports this set-up:

	location ~ ^/adminer(/.*$|$) {
		rewrite ^/adminer$ /adminer/ permanent;
		fastcgi_index index.php;
		include /etc/nginx/fastcgi_params;
		fastcgi_param SCRIPT_FILENAME /var/www/html/index.php; # this is the important part
		fastcgi_pass 127.0.0.1:9000; # host and port goes here
	}

from docker-adminer.

v-nalvarez avatar v-nalvarez commented on July 24, 2024

Hi @TimWolla is there any way to get this to work with Apache? I have this setting and I am facing the same issue
proxypass /myfolder/adminer http://x.x.x.x:8080
proxypassreverse /myfolder/adminer http://x.x.x.x:8080

    <Location /myfolder/adminer>
            AllowOverride All
            Order allow,deny
            Allow from all
    </Location>

adminer.css is being fetched from www.example.com/adminer.css instead of www.example.com/myfolder/adminer.css

Other than the style, everything else is working correctly.

from docker-adminer.

TimWolla avatar TimWolla commented on July 24, 2024

@v-nalvarez I don't have any Apache experience, but this looks like you're using the standalone version. Putting Adminer into a subdirectory with this Docker image is only well-supported if you're using FastCGI. See:

#14 (comment)

from docker-adminer.

CosasDePuma avatar CosasDePuma commented on July 24, 2024

Hi @TimWolla is there any way to get this to work with Apache? I have this setting and I am facing the same issue proxypass /myfolder/adminer http://x.x.x.x:8080 proxypassreverse /myfolder/adminer http://x.x.x.x:8080

    <Location /myfolder/adminer>
            AllowOverride All
            Order allow,deny
            Allow from all
    </Location>

adminer.css is being fetched from www.example.com/adminer.css instead of www.example.com/myfolder/adminer.css

Other than the style, everything else is working correctly.

I think I've found the reason why the theme won't load.
The CSS loads the src "adminer.css", so if your path does NOT end with the slash (/), the last part is replaced with "adminer.css".

For simplicity:

Base URL Theme Request Is CSS loaded correctly?
https://sub.example.tld/sub/db https://sub.example.tld/sub/adminer.css Does not load the CSS
https://sub.example.tld/sub/db/ https://sub.example.tld/sub/db/adminer.css Loads the CSS 🎉

So it is necessary to FORCE the slash to be present, with configurations like these, for example:

Nginx (not tested):

    <Location /sub/db/> # Path ends with slash
            AllowOverride All
            Order allow,deny
            Allow from all
    </Location>

Traefik (tested and working as expected):

labels:
  traefik.enable: true
  traefik.http.routers.adminer.rule: Host(`sub.example.tld`) && PathPrefix(`/sub/db/`) # Path ends with slash
  traefik.http.routers.adminer.entrypoints: https
  traefik.http.routers.adminer.service: adminer
  traefik.http.routers.adminer.middlewares: adminer
  traefik.http.services.adminer.loadbalancer.server.port: 8080
  traefik.http.middlewares.adminer.stripprefix.prefixes: /sub/db

from docker-adminer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.