WebFaction
Community site: login faq

Hi I'm having a little bit of trouble with the 'redirect' method from a sinatra app. My app is running fine on port 51515 I can go to my page http://example.com but when I use redirect "/" or redirect "/anypage/whatever" the redirection uses the port on the address making it http://example.com:51515/anypage/whatever resulting of course in a 404 error. Anyone having this problem?

I know of course that I could just write the full address, but this behaviour is not supposed to happen. So any help would be appreciated.

asked 23 Feb '11, 17:35

Phrozen
51159
accept rate: 40%

I have already checked the problem and it is described pretty well in here: http://groups.google.com/group/rack-devel/browse_thread/thread/ab50ea3e5f06cd6

It seems when Rack is sitting behind a proxy, (example passenger in webfaction with port 51515) the redirect method sees the lack of :port in the address (http://example.com), and falls back to the proxy port (51515) instead of going on with port 80. It seems Rails have its own redirect implementation and its why it works correctly, but other rack apps will fail in these.

Anyone has a solution?

(23 Feb '11, 17:56) Phrozen

Ok, it seems its a Rack error, and they alredy know about it. https://github.com/rack/rack/commit/1c2715778d3753dce4d8df19e3d3cc698aed20c6

I tried to patch my Rack version (1.2.1 after making a cleanup removing 1.0.1 that comes with the installer) but there are many changes in the git version. I used the /rack/lib/rack/request.rb contents from the github version and replaced my own file in the installation.

Everything seems to be working now.

permanent link

answered 23 Feb '11, 18:10

Phrozen
51159
accept rate: 40%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×108
×81
×76
×25
×9

question asked: 23 Feb '11, 17:35

question was seen: 2,880 times

last updated: 23 Feb '11, 18:59

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM