Some buttons redirect to the wrong base URL

I have a bit of a weird setup, so I’ll take a second to describe it.

I didn’t want to open up port 80 on my home router, but I have an AWS. So, I created beer.coloradoicculus.com which, through an nginx reverse proxy, points to home.coloradoicculus.com:12345.

…Those aren’t the actual URLs, so no need to try them :wink:

Anywho, navigating through the kegberry website works great for the most part, but there are a couple of instances that seem to cause issues. Upon logging in, I am redirected to home.coloradoicculus.com/login instead of beer.coloradoicculus.com/login.

The same thing happens when I click on Save Settings under the Advanced tab, and the emails sent out point to home.coloradoicculus.com.

I’m following the crumbs, but have grep’d the entire filesystem for “home.coloradoicculus.com” but didn’t find anything. I also didn’t see anything in mysql, though I admittedly didn’t look for too long.

I somewhat recall setting up that URL during initial setup, but now can’t seem to change it back. Is there any way to do this, or any hints at what I’m looking for? The crumbs have led me to possibly “KEGBOT_BASE_URL” or perhaps something in pykeg.web.urls. Not really sure.

I know I had this issue several years ago when I first had everything up and running, but that was because I was accessing the site via “home.coloradoicculus.com:12345

Thanks for the help. If you have any questions about my setup, I’m free to share.

Seems like I am on the right track!

So there is the line in home/kegbot/kegbot-server.venv/lib/python2.7/site-packages/pykeg/backend/backends.py that has the following routine:

def get_base_url(self):
    """Returns the base URL of the site without a trailing slash.

    Result is used primarily in constructing absolute links back to the
    site, eg in notifications.
    """
    static_url = getattr(settings, 'KEGBOT_BASE_URL', None)
    if static_url:
        return static_url.rstrip('/')
    r = get_current_request()
    if not r:
        raise UnknownBaseUrlException('Cannot determine current request')
    return r.build_absolute_uri('/').rstrip('/')

So my guess is this is what is happening: The site is looking for the KEGBOT_BASE_URL setting, but that setting doesn’t exist. So, the system then goes to build it’s best guess.

The way that I got the email links working was to (shudder) simply override the static_url variable with the line

static_url = "http://beer.coloradoicculus.com"

The next guess would be to add the line

KEGBOT_BASE_URL = 'http://beer.coloradoicculus.com'

but I haven’t seen that work with any of the settings links. Guess I’ll have to sniff up the rest of the trees to find what I’m looking for.

Edit: Added http:// in the urls

Add the line
KEGBOT_BASE_URL = 'http://beer.coloradoicculus.com'
to local_settings.py then restart everything (sudo supervisorctl restart ; sudo service nginx restart).