Set Base URL for Image Files

So we proxy our Omeka site from another server, but are now noticing the links to the images in the site do not have the proper URL, as they are picking up the server name from the server they are on.

Is it possible to set a base URL, that would be used in all page generation?

Thanks.

I think I figured this out so I wanted to share it.

I edited the following line in the bootstrap.php file:

//$base_url = $base_root .= ‘://’ . preg_replace(’/[^a-z0-9-:._]/i’, ‘’, $_SERVER[‘HTTP_HOST’]);

$base_url = $base_root .= ‘://’ . preg_replace(’/[^a-z0-9-:._]/i’, ‘’, ‘server.edu’);

and I just assigned it the server name that we are proxying it from, now all my links are with the correct URL

We at CSUSM also have a problem with our base URL as well, but it is not exactly the same. I would like to share it here.

We also have a proxy, or more accurately a gateway, to our omeka site, like this https://alias.csusm.edu/brewchive pointing to https://host.csusm.edu/brewchive. (NOTE: our https:/alias.csusm.edu is set in a netscaler.)

With our current set up, Omeka is able to render the landing page, but without any CSS and JavaScript code working. A closer examination shows that Omeka is looking for the CSS and JavaScript in the form of http:/alias.csusm.edu/brewchive/…/…/some.css (NOTE: it is using the http protocol).

We don’t like the fact that Omeka is jumping between https and http. We realize that Omeka is not aware of the alias, and it defaults to http:/alias.csusm.edu/brewchive from the initial call to https:/alias.csusm.edu/brewchive.

bootstrap.php before:

// Set the scheme.
if ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] === true))
    || (isset($_SERVER['HTTP_SCHEME']) && $_SERVER['HTTP_SCHEME'] == 'https')
    || (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443)
) {
    $base_root = 'https';
} else {
    $base_root = 'http';
}

After

// Set the scheme.
if ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] === true))
    || (isset($_SERVER['HTTP_SCHEME']) && $_SERVER['HTTP_SCHEME'] == 'https')
    || (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443)
) {
    $base_root = 'https';
} else {
    $base_root = 'http';
}
    $base_root = 'https';

Thank you so much for posting, we just ran into this issue today!

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.