https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31042 --- Comment #2 from David Cook <dcook@prosentient.com.au> --- That's very interesting. I thought maybe the problem was with RequestHeader/RewriteRule not mixing, but the issue exists for both http://localhost:8081/api/v1/patrons and http://localhost:8081/api/v1/app.pl/api/v1/patrons When I dump out the variables from Koha/Middleware/SetEnv.pm I see the data coming through for both the mainpage.pl and the API: 'HTTP_X_KOHA_SETENV' => 'OVERRIDE_SYSPREF_Foo Bar', When I dump %ENV for mainpage.pl, I see lots of HTTP_X headers including: 'HTTP_X_KOHA_SETENV' => 'OVERRIDE_SYSPREF_Foo Bar', When I dump %ENV for API, I don't see any HTTP_X headers... which look like they're just the environmental variables Starman started with... Yep... you need to access the Plack/PSGI-level environmental variables in Mojo::Server::PSGI using $c->req->env. Plack::App::CGIBin uses Plack::App::WrapCGI which resets the %ENV variables at this line: https://metacpan.org/dist/Plack/source/lib/Plack/App/WrapCGI.pm#L48 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.