[GH-ISSUE #31] ViMbAdmin on non-standard port #26

Closed
opened 2026-02-26 09:35:16 +03:00 by kerem · 3 comments
Owner

Originally created by @soalhn on GitHub (Jan 10, 2013).
Original GitHub issue: https://github.com/opensolutions/ViMbAdmin/issues/31

Hi,

I've just installed ViMbAdmin 2.2.2 and noticed that there is an issue in running ViMbAdmin on non-standard port, e.g. https://example.com:8443/mailadmin/ (and in my case non-standard alias "mailadmin").
The first page displays without loading proper css - just like plain html (I've included screenshot - after setup an administrator's account).
As you can see, there's no port "8443" on the browser's status bar.

I've done quick workaround by changing the file "library/ViMbAdmin/Controller/Action.php":

        if( isset( $_SERVER['SERVER_NAME'] ) )
            $view->pagebase = "http{$ssl}://{$_SERVER['SERVER_NAME']}" . Zend_Controller_Front::getInstance()->getBaseUrl();

and adding "Server_PORT" to the "pagebase":

        if( isset( $_SERVER['SERVER_NAME'] ) )
            $view->pagebase = "http{$ssl}://{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}" . Zend_Controller_Front::getInstance()->getBaseUrl();

But I think there should be some checks before, e.g. set the port to other variable in case we are running on non-standard port.
vimbadmin-bug-02

Originally created by @soalhn on GitHub (Jan 10, 2013). Original GitHub issue: https://github.com/opensolutions/ViMbAdmin/issues/31 Hi, I've just installed ViMbAdmin 2.2.2 and noticed that there is an issue in running ViMbAdmin on non-standard port, e.g. https://example.com:8443/mailadmin/ (and in my case non-standard alias "mailadmin"). The first page displays without loading proper css - just like plain html (I've included screenshot - after setup an administrator's account). As you can see, there's no port "8443" on the browser's status bar. I've done quick workaround by changing the file "library/ViMbAdmin/Controller/Action.php": <pre> if( isset( $_SERVER['SERVER_NAME'] ) ) $view->pagebase = "http{$ssl}://{$_SERVER['SERVER_NAME']}" . Zend_Controller_Front::getInstance()->getBaseUrl();</pre> and adding "Server_PORT" to the "pagebase": <pre> if( isset( $_SERVER['SERVER_NAME'] ) ) $view->pagebase = "http{$ssl}://{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}" . Zend_Controller_Front::getInstance()->getBaseUrl();</pre> But I think there should be some checks before, e.g. set the port to other variable in case we are running on non-standard port. ![vimbadmin-bug-02](https://f.cloud.github.com/assets/2156571/56120/7fc6755e-5b06-11e2-9ffc-948223d728f7.png)
kerem closed this issue 2026-02-26 09:35:16 +03:00
Author
Owner

@InRong commented on GitHub (Dec 17, 2013):

Hi,

That is a little specific, more generic would be to replace it with the following:

    if ( ( isset( $_SERVER['SERVER_PORT'] ) && ( $_SERVER['SERVER_PORT'] == 80 )) || ( !isset( $_SERVER['SERVER_PORT'] )) )
        $port = '';
    else
        $port = ':'. $_SERVER['SERVER_PORT'];

    if( isset( $_SERVER['SERVER_NAME'] ) )
        $view->pagebase = "http{$ssl}://{$_SERVER['SERVER_NAME']}{$port}" . Zend_Controller_Front::getInstance()->getBaseUrl();

This may not be the most efficient checking, but I think it catches everything, and it works for http. Just realised it needs something more for HTTPS on 443......

<!-- gh-comment-id:30749867 --> @InRong commented on GitHub (Dec 17, 2013): Hi, That is a little specific, more generic would be to replace it with the following: ``` if ( ( isset( $_SERVER['SERVER_PORT'] ) && ( $_SERVER['SERVER_PORT'] == 80 )) || ( !isset( $_SERVER['SERVER_PORT'] )) ) $port = ''; else $port = ':'. $_SERVER['SERVER_PORT']; if( isset( $_SERVER['SERVER_NAME'] ) ) $view->pagebase = "http{$ssl}://{$_SERVER['SERVER_NAME']}{$port}" . Zend_Controller_Front::getInstance()->getBaseUrl(); ``` This may not be the most efficient checking, but I think it catches everything, and it works for http. Just realised it needs something more for HTTPS on 443......
Author
Owner

@dxtr commented on GitHub (Dec 20, 2013):

Isn't $_SERVER['SERVER_PORT'] ALWAYS there?

InRongs option just seems awfully weird.

<!-- gh-comment-id:31042334 --> @dxtr commented on GitHub (Dec 20, 2013): Isn't `$_SERVER['SERVER_PORT']` ALWAYS there? InRongs option just seems awfully weird.
Author
Owner

@barryo commented on GitHub (Feb 15, 2014):

Should be working fine in V3. At least it works for me. Let us know if there is still an issue under V3.

<!-- gh-comment-id:35151386 --> @barryo commented on GitHub (Feb 15, 2014): Should be working fine in V3. At least it works for me. Let us know if there is still an issue under V3.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ViMbAdmin-opensolutions#26
No description provided.