Skip to content

Clarify how to use APP_BASE and APP_FULL_BASE_URL #174

Description

@johanneskastl

I was trying to set up a PoC for Passbolt today and came across the documentation for the environment variables APP_BASE and APP_FULL_BASE_URL.

It would be great to have this clarified with some examples, because I was not sure:

Do I need to set both of them? APP_BASE to e.g. /passbolt/ and APP_FULL_BASE_URL to https://example.com/passbolt/?
Or is the APP_BASE automatically added to the APP_FULL_BASE_URL variable?

I had lots of funny errors, sometimes links contained /passbolt/passbolt/..., sometimes the links did contain nothing at all. And I did not find the documentation clear enough to find my way through.

If you can explain the basics, I can also come up with a PR.

Thanks in advance!

Activity

  1. garrettboone commented on Jul 27, 2022

    @garrettboone

    @johanneskastl I see you have figured this out from the other thread, but if you have not yet found the examples provided in config file of the passbolt_api repo they are here: https://github.com/passbolt/passbolt_api/blob/master/config/passbolt.default.php

  2. johanneskastl commented on Jul 27, 2022

    @johanneskastl
    ContributorAuthor

    @garrettboone Thanks for the link. This at least clarifies that the APP_BASE must not contain a trailing slash.

    But it still does not answer, if APP_FULL_BASE_URL should contain the subdirectory?

    I prepared a PR to improve the documentation, I would be glad if you could have a look at #176

  3. garrettboone commented on Jul 27, 2022

    @garrettboone
  4. garrettboone commented on Jul 28, 2022

    @garrettboone

    "APP_BASE" is a folder on the server. Variables with "URL" in the name are related to the URL. I think you are confusing the term "directory" with url "path".

  5. johanneskastl commented on Jul 28, 2022

    @johanneskastl
    ContributorAuthor

    "APP_BASE" is a folder on the server. Variables with "URL" in the name are related to the URL. I think you are confusing the term "directory" with url "path".

    Hi @garrettboone I might be confusing things, yes. That is why I would like to improve the documentation on that. :-)

    It boils down to this:
    I want passbolt to be reachable via example.com/passbolt. What is needed to do that?

  6. garrettboone commented on Jul 28, 2022

    @garrettboone

    @johanneskastl Just to confirm, the passbolt path is only in the url and does not reflect a folder on your server you have created named passbolt, correct?

    See https://community.passbolt.com/t/passbolt-install-in-a-subfolder/2885/5

    Though they still used a folder, NGINX can handle the rewriting of the path.

  7. garrettboone commented on Jul 29, 2022

    @garrettboone

    @johanneskastl do you need the /passbolt/ path to continue to show? Or, is it enough for you if that path gets re-written so it does not show.?

    For example if you add this to your NGINX config it will cause the url to be rewritten from example.com/passbolt/params to just example.com/params:

    location /passbolt {
      rewrite ^/passbolt(.*)$ https://example.com$1 break;
    }
    

    This assumes that users can access the host url on it's own (example.com). So, if you need the /passbolt to always show, but you do NOT want to install the app in a different location then you need to do the following:

    1. add another server section to your NGINX with a separate port and configure NGINX to be a reverse proxy to this other port. Like this:
    upstream passbolt {
            server 127.0.0.1:4444;
    }
    
    server {
            listen 80;
            server_name    example.com;
            return 301 https://example.com;
    }
    
    server {
            listen 443 ssl http2;
    
            server_name example.com
    
            # ssl stuff
    
            location /passbolt/ {
                    proxy_pass https://passbolt/;
                    proxy_set_header    Host            $host;
            }
    }
    
    server {
            listen 4444 ssl http2;
            server_name 127.0.0.1;
    
            root /usr/share/php/passbolt/webroot;
            index index.php;
    
            location / {
                    try_files $uri $uri/ /index.php?$args;
            }
    
            location ~ \.php$ {
                    try_files                $uri =404;
                    include                  fastcgi_params;
                    fastcgi_pass             unix:/run/php/php7.4-fpm.sock;
                    fastcgi_index            index.php;
                    fastcgi_intercept_errors on;
                    fastcgi_split_path_info  ^(.+\.php)(.+)$;
                    fastcgi_param            SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    fastcgi_param            SERVER_NAME $http_host;
                    fastcgi_param            PHP_VALUE "upload_max_filesize=5M post_max_size=5M";
            }
    }
    
    
    1. To passbolt.php add 'base' => '/passbolt',

    This fools the app into thinking it's installed in a passbolt folder but it's not. I've left out some NGINX ssl options and other things...but hopefully this helps.

  8. johanneskastl commented on Jul 29, 2022

    @johanneskastl
    ContributorAuthor

    do you need the /passbolt/ path to continue to show? Or, is it enough for you if that path gets re-written so it does not show.?

    Hi @garrettboone Thanks for the long and detailed answer.

    I would need the /passbolt to show in the URL, to not confuse users, as / is serving other content unrelated to Passbolt.

    As I am using the docker container, I cannot modify the application (or move it) inside the docker container, except via environment variables. Hence I thought I could solve this using APP_BASE.

    As this is being served behind a Traefik as reverse proxy, I am currently trying to get it to do the magic. I'll try to translate your nginx example, but this might fail, as I cannot move the webroot to /usr/share/php/passbolt/webroot (docker container...).

  9. garrettboone commented on Jul 29, 2022

    @garrettboone

    The forum can help. There are many ways to handle it.

  10. self-assigned this
    on Nov 16, 2022
  11. dlen commented on Nov 16, 2022

    @dlen
    Member

    Hi!

    Would it be enough to publish a better readme section regarding these env variables APP_BASE and APP_FULL_BASE_URL?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions