I’m not the original poster, but I’m having the same issue. An apply_filter would be useful, or even a ternary like below would likely fix for these instances:
$domain_name = $_SERVER['SERVER_NAME'] !== 'localhost' ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];
$real_url .= $domain_name . $REQUEST_URI;
I would appear that I can get this to work if I break each IMG in the hidden WP [gallery] into their own a href sharing the same rel but this is not ideal.
Is there a way to give all the images in the gallery the same rel all at once?