Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Overriding the base site URL in e-mail notifications

I run my forum from two domains:

https://example.com (https)
http://insecure.example.com (http)

When a user uses insecure.foo.com, any notification e-mails generated from their actions will contain links via insecure.foo.com

I don't want users to ever hit insecure.foo.com except by manual intervention on the user's part. The domain is there only to service a handful of users who sit behind firewalls that mess with our HTTPS connection.

Is there an easy way to ensure e-mails generated by the forums always use https://example.com as their base URL?

Tagged:

Comments

  • hgtonighthgtonight ∞ · New Moderator

    Setting the configuration Garden.WebRoot should sort you out.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • jamesincjamesinc Sydney ✭✭

    @hgtonight, that doesn't appear to have resolved the issue.

    $Configuration['Garden']['WebRoot'] = "https://example.com/";
    

    I dug a little deeper, and found that setting

    $Configuration['Garden']['ExternalUrlFormat'] = "https://example.com/%s";
    

    Solved the problem for some notifications. Notifications about comments ("so-and-so has commented on...") now display the correct base URL, however so-and-so has created a discussion does not.

    I believe I have traced the problem. When creating discussions, the URL is given by DiscussionUrl in /library/core/functions.render.php. This ultimately gets its information from _LoadEnvironment() in /library/core/class.request.php:

          $this->RequestHost(     isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? val('HTTP_X_FORWARDED_HOST',$_SERVER) : (isset($_SERVER['HTTP_HOST']) ? val('HTTP_HOST',$_SERVER) : val('SERVER_NAME',$_SERVER)));
    

    Or maybe I'm just bonkers and missing the obvious.

Sign In or Register to comment.