Koha's OAI-PMH server returns the "request URL" in a "request" element. If a requestURL isn't provided as an argument to a response, CGI::self_url() is used. In Koha, we often use $repository->self_url(), but self_url isn't a method in the $repository object or its parent classes. Rather, CGI::self_url is imported into Koha::OAI::Server::Repository and via Perl automagic it acts like a method. This is a problem for a number of reasons. Firstly, the path is incorrect. In KTD when using Plack, you wind up with a request URL like http://localhost:8080/opac/oai.pl. If you have a reverse proxy and you're doing things like HTTPS offloading, you'll wind up with a HTTP instead of a HTTPS URL. Stuff like that. This also affects the "baseURL" used in the Identify response. -- We should have a method like "repo_url()" where we use OPACBaseURL and rewrite the path using something like the following: s!^/opac!/cgi-bin/koha!
Note that I've been setting the requestURL in Koha::OAI::Server::Repository for many years locally, as I had some OAI-PMH consumer that needed it fixed. But there are other Koha/OAI/Server/* modules that need to be updated too. I'll need to do some refactoring of what I have to cover what I describe in the "Description", but it shouldn't be that hard. Just need to get a round tuit...