# Mongrel don't render html if i use .htaccess

**URL:** <https://www.ruby-forum.com/t/mongrel-dont-render-html-if-i-use-htaccess/198395>\
**Category:** Mongrel\
**Created:** [October 31, 2010, 1:21pm UTC](https://www.ruby-forum.com/t/mongrel-dont-render-html-if-i-use-htaccess/198395 "2010-10-31T13:21:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![okkezSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/85f322/32.png) [@okkezSS](https://www.ruby-forum.com/u/okkezSS)\
**Post date:** [October 31, 2010, 1:21pm UTC](https://www.ruby-forum.com/t/mongrel-dont-render-html-if-i-use-htaccess/198395/1 "2010-10-31T13:21:33Z")

</div>

Hy,

Being new here i hope somebody can help me.

Setup:

CentOS 5.5  
ruby 1.8.7 (2009-06-08 patchlevel 173) [i686-linux]  
Rails 2.3.8  
mongrel 1.1.5  
rack 1.2.1, 1.0.1

Problem:

If i use a .htaccess like

RewriteEngine on

RewriteCond %{HTTP\_HOST} ^my.domain.com$ [OR]  
RewriteCond %{HTTP\_HOST} ^www.my.domain.com$  
RewriteRule ^(.\*)$ “http://127.0.0.1:12001/$1” [P,L]

on a app what is using a DB i see only html source. Navigating to  
[my.domain.com:12001](http://my.domain.com:12001) works fine. When i make a app with a simple var in  
the controller and a view that echo’s this var i don’t have any trouble.

What i have figured out:

In the mongrel log i found

Error calling Dispatcher.dispatch #\<NameError: undefined local variable  
or method `head' for #<Mongrel::CGIWrapper:0xb712ffa4>> /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/cgi.rb:108:in `send\_cookies’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel/cgi.rb:136:in  
`out' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/http_response.rb:65:in `start’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel/cgi.rb:135:in  
`out' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:81:in `process’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel.rb:159:in  
`process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:in `each’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel.rb:158:in  
`process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `run’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel.rb:285:in  
`initialize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `new’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel.rb:285:in  
`run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `initialize’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel.rb:268:in  
`new' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `run’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel/configurator.rb:282:in  
`run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:281:in `each’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel/configurator.rb:281:in  
`run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run’  
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/…/lib/mongrel/command.rb:212:in  
`run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281 /usr/bin/mongrel_rails:19:in `load’  
/usr/bin/mongrel\_rails:19

I edit mongrel/lib/mongrel/cgi.rb as described in  
[http://github.com/fauna/mongrel/blob/master/lib/mongrel/cgi.rb#L108](http://github.com/fauna/mongrel/blob/master/lib/mongrel/cgi.rb#L108)

I found cookie’s from [my.domain.com](http://my.domain.com) in my browser

Can anyone point me in the right direction?

Thanks!
