Issues with RT4.x and apache proxypass and white space in search results

Hi all,
We would like to proxypass traffic for RT for various reasons. This
works perfectly for most applications and for about 95% of RT. The issue
is in the Query Builder. The Results.html contains spaces in the URL.
This causes problems for Apache’s proxypass / proxypassreverse. It
replaces white spaces with %2x and RT blows up with this error: “An
internal RT error has occurred. Your administrator can find more details
in RT’s log files.” Does anyone know how to fix this issue?

Thanks,

Pete

Peter Boguszewski
Technical Manager of Library Systems
UW Madison - Library Technology Group
pboguszewski@library.wisc.edu
608.262.4768

We would like to proxypass traffic for RT for various reasons.

This works perfectly for most applications and for about 95% of RT.
The issue is in the Query Builder. The Results.html contains spaces
in the URL. This causes problems for Apache’s proxypass /
proxypassreverse. It replaces white spaces with %2x and RT blows up
with this error: “An internal RT error has occurred. Your
administrator can find more details in RT’s log files.” Does anyone
know how to fix this issue?

You left out your actual RT version.
Using 4.0.11 and a proxypass configuration, I don’t see any
unescaped whitespace when using the Query Builder.

Also - you can always look in the backend RT server’s logs to see the
full error. This is the only real way to debug what you’re seeing.

-kevin

I can replicate this problem with RT 4.0.11 in many ways. I have tried
apache 2.2.x and 2.4.x with ProxyPass and ReWrite rules with the
NoEscape option [NE]. This does not fix the problem. Here is the exact
way to replicate the issue.

With ProxyPass enabled go to Query Builder and add any search term,
select “Add these terms and Search”. This will blow up with a URL that
contains escape characters like this:

Search/Results.html?Format=%2527%2520%2520%2520%253Cb%253E%253Ca%2520href%253D%2522__WebPath__%252FTicket%252FDisplay.html%253Fid%253D__id__%2522%253E__id__%253C%252Fa%253E%253C%252Fb%253E%252FTITLE%253A%2523%2527%252C%250A%2527%253Cb%253E%253Ca%2520href%253D%2522__WebPath__%252FTicket%252FDisplay.html%253Fid%253D__id__%2522%253E__Subject__%253C%252Fa%253E%253C%252Fb%253E%252FTITLE%253ASubject%2527%252C%250A%2527__Status__%2527%252C%250A%2527__QueueName__%2527%252C%250A%2527__OwnerName__%2527%252C%250A%2527__Priority__%2527%252C%250A%2527__NEWLINE__%2527%252C%250A%2527%2527%252C%250A%2527%253Csmall%253E__Requestors__%253C%252Fsmall%253E%2527%252C%250A%2527%253Csmall%253E__CreatedRelative__%253C%252Fsmall%253E%2527%252C%250A%2527%253Csmall%253E__ToldRelative__%253C%252Fsmall%253E%2527%252C%250A%2527%253Csmall%253E__LastUpdatedRelative__%253C%252Fsmall%253E%2527%252C%250A%2527%253Csmall%253E__TimeLeft__%253C%252Fsmall%253E%2527&Order=ASC%257CASC%257CASC%257CASC&OrderBy=id%257C%257C%257C&Query=id%2520%253C%25202000&RowsPerPage=50&SavedChartSearchId=new&SavedSearchId=new

Without changing anything I can get the search to work by going back to
the query builder and adding a search term but instead of choosing “Add
these terms and Search” I select “Add these terms” then the click the
“Show Results” link that appears. Here is the same exact search result URL:

Search/Results.html?SavedChartSearchId=new&RowsPerPage=50&Page=&Format=‘+++<a+href%3D"WebPath%2FTicket%2FDisplay.html%3Fid%3D__id__">id<%2Fa><%2Fb>%2FTITLE%3A%23’%2C%0A’<a+href%3D"WebPath%2FTicket%2FDisplay.html%3Fid%3D__id__">Subject<%2Fa><%2Fb>%2FTITLE%3ASubject’%2C%0A’Status’%2C%0A’QueueName’%2C%0A’OwnerName’%2C%0A’Priority’%2C%0A’NEWLINE’%2C%0A’‘%2C%0A’Requestors<%2Fsmall>‘%2C%0A’CreatedRelative<%2Fsmall>‘%2C%0A’ToldRelative<%2Fsmall>‘%2C%0A’LastUpdatedRelative<%2Fsmall>‘%2C%0A’TimeLeft<%2Fsmall>'&Order=ASC|ASC|ASC|ASC&SavedSearchId=&Query=id+<+2000&OrderBy=id|||

The difference I notice in the code is that the “Add these terms and
Search” button uses a perl url redirect where the “Show Results” link
does not. Here is the log output from the errored search (with server
location starred out):

[Thu Apr 18 16:52:51 2013] [error]: The ‘message’ parameter ("Wrong
query, expecting a OPERATOR in ‘id%>20<–here%3C%202000’ at
/*****//rt-4.0.11/sbin/../lib/RT/SQL.pm line 135.

Stack:
[///rt-4.0.11/sbin/../lib/RT/SQL.pm:135]
[/
//rt-4.0.11/sbin/../lib/RT/Tickets_SQL.pm:237]
[///rt-4.0.11/sbin/../lib/RT/Tickets_SQL.pm:293]
[/
//rt-4.0.11/share/html/Search/Results.html:109]
[///rt-4.0.11/sbin/../lib/RT/Interface/Web.pm:635]
[/
//rt-4.0.11/sbin/../lib/RT/Interface/Web.pm:336]
[///rt-4.0.11/share/html/autohandler:53]
") to Log::Dispatch::Output::log was a ‘hashref object’, which is not
one of the allowed types: scalar
at
/
/perl/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Params/Validate/XS.pm
line 11.
Params::Validate::XS::ANON(‘The 'message' parameter
("Wrong query, expecting a OPERATOR…’) called at
//perl/perl-5.16.3/lib/site_perl/5.16.3/Log/Dispatch/Output.pm line 39
Log::Dispatch::Output::log(undef, ‘level’, ‘error’, ‘name’,
‘screen’, ‘message’, ‘HTML::Mason::Exception=HASH(0x6a95280)’) called at
/
/perl/perl-5.16.3/lib/site_perl/5.16.3/Log/Dispatch.pm line 214
Log::Dispatch::log_to(‘Log::Dispatch=HASH(0xb84808)’, ‘level’,
‘error’, ‘name’, ‘screen’, ‘message’,
‘HTML::Mason::Exception=HASH(0x6a95280)’) called at
//perl/perl-5.16.3/lib/site_perl/5.16.3/Log/Dispatch.pm line 167
Log::Dispatch::_log_to_outputs(‘Log::Dispatch=HASH(0xb84808)’, ‘level’,
‘error’, ‘message’, ‘HTML::Mason::Exception=HASH(0x6a95280)’) called at
/
/perl/perl-5.16.3/lib/site_perl/5.16.3/Log/Dispatch.pm line 145
Log::Dispatch::log(‘Log::Dispatch=HASH(0xb84808)’, ‘level’,
‘error’, ‘message’, ‘’) called at
//perl/perl-5.16.3/lib/site_perl/5.16.3/Log/Dispatch.pm line 42
Log::Dispatch::ANON(‘Log::Dispatch=HASH(0xb84808)’, ‘’)
called at /
//rt-4.0.11/sbin/../lib/RT/Tickets_SQL.pm line 295
RT::tickets::FromSQL(‘RT::Tickets=HASH(0x689e1a0)’,
‘id%20%3C%202000’) called at
///rt-4.0.11/share/html/Search/Results.html line 109
HTML::Mason::Commands::ANON(‘Order’,
‘ASC%7CASC%7CASC%7CASC’, ‘Query’, ‘id%20%3C%202000’, ‘SavedSearchId’,
‘new’, ‘SavedChartSearchId’, ‘new’, ‘OrderBy’, …) called at
/
/perl/perl-5.16.3/lib/site_perl/5.16.3/HTML/Mason/Component.pm
line 138
HTML::Mason::Component::run(‘HTML::Mason::Component::FileBased=HASH(0x6a72f58)’,
‘Order’, ‘ASC%7CASC%7CASC%7CASC’, ‘Query’, ‘id%20%3C%202000’,
‘SavedSearchId’, ‘new’, ‘SavedChartSearchId’, ‘new’, …) called at
//perl/perl-5.16.3/lib/site_perl/5.16.3/HTML/Mason/Request.pm line 1305
eval {…} called at
/
/perl/perl-5.16.3/lib/site_perl/5.16.3/HTML/Mason/Request.pm line 1295
HTML::Mason::Request::comp(undef, undef, undef, ‘Order’,
‘ASC%7CASC%7CASC%7CASC’, ‘Query’, ‘id%20%3C%202000’, ‘SavedSearchId’,
‘new’, …) called at ///rt-4.0.11/sbin/../lib/RT/Interface/Web.pm
line 635
RT::Interface::Web::ShowRequestedPage(‘HASH(0x69bb6a8)’) called
at /
//rt-4.0.11/sbin/../lib/RT/Interface/Web.pm line 336
RT::Interface::Web::HandleRequest(‘HASH(0x69bb6a8)’) called at
/*****//rt-4.0.11/share/html/autohandler line 53
HTML::Mason::Commands::ANON(‘SavedChartSearchId’, ‘new’,
‘Format’,
'%27%20%20%20%3Cb%3E%3Ca%20href%3D%22__WebPath
_%2FTicket%2FDi…',
‘Query’, ‘id%20%3C%202000’, ‘Order’, ‘ASC%7CASC%7CASC%7CASC’,
‘SavedSearchId’, …) called at
//perl/perl-5.16.3/lib/site_perl/5.16.3/HTML/Mason/Component.pm
line 138
HTML::Mason::Component::run(‘HTML::Mason::Component::FileBased=HASH(0x673e0b0)’,
‘SavedChartSearchId’, ‘new’, ‘Format’,
‘%27%20%20%20%3Cb%3E%3Ca%20href%3D%22__WebPath__%2FTicket%2FDi…’,
‘Query’, ‘id%20%3C%202000’, ‘Order’, ‘ASC%7CASC%7CASC%7CASC’, …)
called at
/
/perl/perl-5.16.3/lib/site_perl/5.16.3/HTML/Mason/Request.pm line 1300
eval {…} called at
//perl/perl-5.16.3/lib/site_perl/5.16.3/HTML/Mason/Request.pm line 1295
HTML::Mason::Request::comp(undef, undef, undef,
‘SavedChartSearchId’, ‘new’, ‘Format’,
‘%27%20%20%20%3Cb%3E%3Ca%20href%3D%22__WebPath__%2FTicket%2FDi…’,
‘Query’, ‘id%20%3C%202000’, …) called at
/
/perl/perl-5.16.3/lib/site_perl/5.16.3/HTML/Mason/Request.pm line 484
eval {…} called at
//perl/perl-5.16.3/lib/site_perl/5.16.3/HTML/Mason/Request.pm line 484
eval {…} called at
/
/perl/perl-5.16.3/lib/site_perl/5.16.3/HTML/Mason/Request.pm line 436
HTML::Mason::Request::exec(‘RT::Interface::Web::Request=HASH(0x69b4e08)’) called
at
//perl/perl-5.16.3/lib/site_perl/5.16.3/HTML/Mason/PSGIHandler.pm
line 85
eval {…} called at
/
/perl/perl-5.16.3/lib/site_perl/5.16.3/HTML/Mason/PSGIHandler.pm
line 85
HTML::Mason::Request::PSGI::exec(‘RT::Interface::Web::Request=HASH(0x69b4e08)’)
called at
//perl/perl-5.16.3/lib/site_perl/5.16.3/HTML/Mason/Interp.pm line 345
HTML::Mason::Interp::exec(undef, undef, ‘SavedChartSearchId’,
‘new’, ‘Format’,
‘%27%20%20%20%3Cb%3E%3Ca%20href%3D%22__WebPath__%2FTicket%2FDi…’,
‘Query’, ‘id%20%3C%202000’, ‘Order’, …) called at
/
/perl/perl-5.16.3/lib/site_perl/5.16.3/HTML/Mason/PSGIHandler.pm
line 48
eval {…} called at
//perl/perl-5.16.3/lib/site_perl/5.16.3/HTML/Mason/PSGIHandler.pm
line 48
HTML::Mason::PSGIHandler::invoke_mason(‘HTML::Mason::PSGIHandler::Streamy=HASH(0x663ceb0)’,
‘HTML::Mason::FakeApache=HASH(0x69ad848)’, ‘HASH(0x69adb48)’) called at
/
/perl/perl-5.16.3/lib/site_perl/5.16.3/HTML/Mason/PSGIHandler/Streamy.pm
line 52
HTML::Mason::PSGIHandler::Streamy::ANON(‘CODE(0x6a770c8)’) called at
///rt-4.0.11/sbin/../lib/RT/Interface/Web/Handler.pm line 303
RT::Interface::Web::Handler::ANON(‘CODE(0x6a770c8)’) called
at /
/perl/perl-5.16.3/lib/site_perl/5.16.3/Plack/Util.pm line 301
Plack::Util::ANON(‘CODE(0x6a77200)’) called at
//perl/perl-5.16.3/lib/site_perl/5.16.3/Plack/Handler/FCGI.pm line 136
Plack::Handler::FCGI::run(‘Plack::Handler::FCGI=HASH(0x6654470)’,
‘CODE(0x6306f08)’) called at
/
/perl/perl-5.16.3/lib/site_perl/5.16.3/Plack/Loader.pm line 84
Plack::Loader::run(‘Plack::Loader=HASH(0x6654668)’,
‘Plack::Handler::FCGI=HASH(0x6654470)’) called at
//perl/perl-5.16.3/lib/site_perl/5.16.3/Plack/Runner.pm line 277
Plack::runner::run(‘Plack::Runner=HASH(0x6307b38)’,
‘CODE(0x6306f08)’) called at /
//rt-4.0.11/sbin/rt-server.fcgi line 233
eval {…} called at /*****//rt-4.0.11/sbin/rt-server.fcgi line 233

Stack:
[//perl/perl-5.16.3/lib/5.16.3/Carp.pm:101]
[/
/perl/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Params/Validate/XS.pm:11]
[//perl/perl-5.16.3/lib/site_perl/5.16.3/Log/Dispatch/Output.pm:39]
[/
/perl/perl-5.16.3/lib/site_perl/5.16.3/Log/Dispatch.pm:214]
[//perl/perl-5.16.3/lib/site_perl/5.16.3/Log/Dispatch.pm:167]
[/
/perl/perl-5.16.3/lib/site_perl/5.16.3/Log/Dispatch.pm:145]
[//perl/perl-5.16.3/lib/site_perl/5.16.3/Log/Dispatch.pm:42]
[/
//rt-4.0.11/sbin/../lib/RT/Tickets_SQL.pm:295]
[///rt-4.0.11/share/html/Search/Results.html:109]
[/
//rt-4.0.11/sbin/../lib/RT/Interface/Web.pm:635]
[///rt-4.0.11/sbin/../lib/RT/Interface/Web.pm:336]
[/
//rt-4.0.11/share/html/autohandler:53]
(/*****//rt-4.0.11/sbin/../lib/RT/Interface/Web/Handler.pm:208)On 4/16/2013 9:52 AM, Peter Boguszewski wrote:

Hi all,
We would like to proxypass traffic for RT for various reasons.
This works perfectly for most applications and for about 95% of RT.
The issue is in the Query Builder. The Results.html contains spaces
in the URL. This causes problems for Apache’s proxypass /
proxypassreverse. It replaces white spaces with %2x and RT blows up
with this error: “An internal RT error has occurred. Your
administrator can find more details in RT’s log files.” Does anyone
know how to fix this issue?

Thanks,

Pete

Peter Boguszewski
Technical Manager of Library Systems
UW Madison - Library Technology Group
pboguszewski@library.wisc.edu
608.262.4768

I can replicate this problem with RT 4.0.11 in many ways. I have tried
apache 2.2.x and 2.4.x with ProxyPass and ReWrite rules with the
NoEscape option [NE]. This does not fix the problem. Here is the exact
way to replicate the issue.

With ProxyPass enabled go to Query Builder and add any search term,
select “Add these terms and Search”. This will blow up with a URL that
contains escape characters like this:

That doesn’t happen in an Apache config using ProxyPass for me.

Please show your full Apache config and tell us about the backend server
you’re proxying to.