#204 absolute vs. relative "Location:" redirects

v2.3.1
closed-fixed
nobody
None
5
2012-05-28
2010-08-03
gw0
No

I noticed that every time I try to add a new domain alias, the following page opens "/postfixadmin/create-alias-domain.php" to display it successfully done its job. Unfortunately I am using a reverse proxy on some other URL (not /postfixadmin/) that opens pages on the server where Postfix Admin lives (here it is in /postfixadmin).

All other pages and functions seem to work fine, problems are just with adding new domain aliases. It seems that there is a hardcoded URL of some sort and it would be better to use relative links like everywhere else.

Discussion

  • gw0

    gw0 - 2010-08-03

    Ok, it seems $CONF['postfix_admin_url'] is being used and I misconfigured it. It is weird though that adding normal aliases works fine...

     
  • gw0

    gw0 - 2010-08-03
    • status: open --> open-invalid
     
  • Christian Boltz

    Christian Boltz - 2010-09-11

    Just a technical explanation:

    create-alias-domain.php has (technically correct):
    header("Location: " . $CONF['postfix_admin_url'] . "/main.php");

    edit-alias.php has (not really correct because redirects have to use absolute URLs, but it seems to work with all browsers even with relative paths)
    header ("Location: list-virtual.php?domain=$fDomain");

    oh, and create-alias does not do any redirects ;-)

    That said: we should use absolute _or_ relative redirects, but not a mix of it. Funnily, the technically wrong solution (relative redirects) tend to be the better solution because they work even if $CONF['postfix_admin_url'] is incorrect. It seems all browsers accept it since nobody complained yet that for example the edit-alias redirect doesn't work.

    GingerDog: what is your opinion about this?

     
  • Christian Boltz

    Christian Boltz - 2010-09-11
    • summary: Hard coded URL when adding domain aliases --> absolute vs. relative "Location:" redirects
    • status: open-invalid --> open
     
  • GingerDog

    GingerDog - 2010-09-14

    Use relative URLs where possible - ideally we could get rid of $CONF['postfix_admin_url'] then.

     
  • Christian Boltz

    Christian Boltz - 2011-04-09

    I changed most of the Location: headers to relative paths in SVN trunk r1021.

    "most" means that some not-so-easy cases still need to be fixed. $CONF['postfix_admin_url'] is still used in:
    - functions.inc.php - authentication_require_role()
    - smarty.inc.php - as prefix for $CONF['theme_css'] and $CONF['theme_logo']
    - and obviously config.*.php

     
  • Christian Boltz

    Christian Boltz - 2012-05-28

    Finally fixed in SVN trunk (commits: r1394, r1395, r1396)

    I removed the config option $CONF['postfix_admin_url'] - it is no longer needed.

     
  • Christian Boltz

    Christian Boltz - 2012-05-28
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks