0

I have a unique situation where I'm reverse-proxying an EE site into another domain via Akamai. The origin hostname of the EE site is smallbusiness.pb.com and Akamai rewrites sends traffic coming in via www.pb.com/smb to that URL.

In order to make Structure navigation listings have the correct endpoint URL, I had to modify my Focus Lab LLC configuration by adding the following to my config.prod.php file:

$base_url = $protocol . 'www.pb.com' . '/smb';

Everything has been fine since I have been manually deploying from staging to production by synching the database and rsyncing files.

Now that I'm rolling out BetterWorkflow, however, I'm running into 403 Forbidden on Assets image thumbnail requests. Those requests are to the www.pb.com/smb URL instead of smallbusiness.pb.com.

Here's a sample of the error:

Request URL:http://www.pb.com/smb/?ACT=59&file_id=2&size=67x67&hash=1352925992
Request Method:GET
Status Code:403 Forbidden

Request Headers

Accept:*/*
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:keep-alive
Cookie:[redacted]
Host:www.pb.com
Pragma:no-cache
Referer:http://smallbusiness.pb.com/smb/admin.php?S=0&D=cp&C=content_publish&M=entry_form&channel_id=3&entry_id=10&parent_id=0
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17
Query String Parametersview sourceview URL encoded
ACT:59
file_id:2
size:67x67
hash:1352925992

Response Headers

Access-Control-Allow-Origin:*
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:0
Content-Type:text/html
Date:Wed, 23 Jan 2013 21:34:55 GMT
Expires:Wed, 23 Jan 2013 21:34:58 GMT
Server:Apache
Set-Cookie:exp_last_activity=1358976898; expires=Thu, 23-Jan-2014 21:34:58 GMT; path=/
Vary:Accept-Encoding

What I'm looking for is a way in my configuration file to have one base_url when browsing the control panel via smallbusiness.pb.com and another base_url when the public site is browsed via www.pb.com.

Any ideas?

1

Without actually testing this maybe you could use a Request Contant along with a conditional like so in your FocusLab config file:

if (REQ == 'CP')
{
    $base_url = $protocol . 'smallbusiness.pb.com';
}
else
{
    $base_url = $protocol . 'www.pb.com' . '/smb';
}

You could edit this how you see fit of course though, it's a basic example/start.

Again, please test and let us know :)

  • This looks great, Nate. I'll check it out with some mods and let you know. Thanks! – Ian Pitts Jan 24 '13 at 2:22
  • Nate, you're a genius and a lifesaver, AGAIN! Thank you ! – Ian Pitts Jan 24 '13 at 2:44
  • Well, I can't take full credit for this one, maybe only partial credit. Take a look at this question here to see what I mean and note the answer :) – Natetronn Jan 24 '13 at 2:50
  • Spoke too soon. The normal entry page now shows Assets thumbnails. The last remaining issue is with the Assets modal that slides down from the top when adding new images. I'm still getting www.pb.com URLs there. Any idea how to determine the request type for those? – Ian Pitts Jan 24 '13 at 2:50
  • Could this have to do with your File Upload Preferences? – Natetronn Jan 24 '13 at 2:54
0

The information Nate posted was quite helpful. Based on that and some reading on the link he posted, I was able to come up with the following, which I added to config.master.php:

    switch ($_SERVER['HTTP_HOST']) {
        case 'smb-staging.pb.com' :
            $base_url = $protocol . $_SERVER['HTTP_HOST'] . '/smb';
        break;

        case 'smbdev.pb.com' :
            $base_url = $protocol . $_SERVER['HTTP_HOST'] . '/smb';
        break;

        default :
            if (REQ == 'CP' || REQ == 'ACT' || AJAX_REQUEST)
            {
                $base_url = $protocol . 'smallbusiness.pb.com' . '/smb';
            } else {
                $base_url = $protocol . 'www.pb.com' . '/smb';
            }
        break;
    }
  • Darn, I should have tested this further. Now Structure page URLs are rendering as smallbusiness.pb.com. Somehow that exp:structure:nav tag is interpreted as CP or ACT and all of my base_urls are rendering incorrectly. – Ian Pitts Jan 24 '13 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.