Getting "not found" when connecting from reverse proxy
Added by Pawel Veselov almost 12 years ago
Hi.
I've never used Ruby or Rails before, but I saw Redmine used someplace, liked it, and want to set up my own.
It's running on an internal server, I have Apache with the reverse proxy configuration in front of it. Apache serves a lot of other stuff, so I moved redmine to be served on /redmine. I added 'map /redmine' to config.ru and set relative_url root to '/redmine' in environment.rb. It all works when I access it from the local system. But it returns 404 when I'm connecting to it through the proxy. I don't quite understand why (and it may not even be related to Redmine, but to Rails/WEBrick instead), except that is seems to have something to do with presence of X-Forwarded* headers.
Works:
[vps@druid]~/soft/redmine-2.3.2$ telnet druid.vps 3000 Trying 10.12.74.12... Connected to druid.vps. Escape character is '^]'. GET /redmine HTTP/1.1 Host: druid.vps:3000 Connection: close HTTP/1.1 302 Found Location: http://druid.vps:3000/redmine/login?back_url=http%3A%2F%2Fdruid.vps%3A3000%2Fredmine%2F Content-Type: text/html; charset=utf-8 X-Ua-Compatible: IE=Edge,chrome=1 Cache-Control: no-cache X-Request-Id: 715a05aef92c079c9736007f23833c2a X-Runtime: 0.004528 Date: Mon, 12 Aug 2013 07:27:51 GMT X-Rack-Cache: miss Server: WEBrick/1.3.1 (Ruby/2.0.0/2013-06-27) Content-Length: 153 Connection: close
Doesn't work:
[vps@druid]~/soft/redmine-2.3.2$ telnet druid.vps 3000 Trying 10.12.74.12... Connected to druid.vps. Escape character is '^]'. GET /redmine HTTP/1.1 Host: druid.vps:3000 X-Forwarded-Host: public.host.com Connection: close HTTP/1.1 404 Not Found Content-Type: text/plain X-Cascade: pass Content-Length: 19 Server: WEBrick/1.3.1 (Ruby/2.0.0/2013-06-27) Date: Mon, 12 Aug 2013 07:27:40 GMT Connection: close Not Found: /redmineConnection closed by foreign host.
So, once X-Forwarded-Host header is found, things just stop working. Anything that would help me understand why?
Thank you.