Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rewrite_url adds port twice #4816

Closed
ndemoreau opened this issue Feb 1, 2012 · 12 comments
Closed

rewrite_url adds port twice #4816

ndemoreau opened this issue Feb 1, 2012 · 12 comments
Assignees

Comments

@ndemoreau
Copy link

This is the re-opening of an old ticket you can find here: https://rails.lighthouseapp.com/projects/8994/tickets/1106-rewrite_url-adds-port-twice.

The issue is:

Whenever I use an url_helper or a redirect in development mode, the port is added twice to the url: http://localhost:3000:3000/clips

Is it supposed to be fixed in Rails 3? I'm having the issue in rails 3.1 and 3.2.

@nashby
Copy link
Contributor

nashby commented Feb 1, 2012

but there is no rewrite_url method in rails 3 or I missing something?

@ndemoreau
Copy link
Author

Indeed, you are right. I copy-pasted the title of the old post, because, despite the fact that this rewrite_url method doesn't exist anymore, the port is still added twice in many case. And I don't know why...

I thought it was due to a use of request.host_with_port instead of request.host at some places in the code. I tried to patch it but without success.

I also tried to override following method:

def default_url_options( options = {} )
options.merge( { :only_path => false, :host => DEFAULT_HOST_WITH_PORT } )
end
where DEFAULT_HOST_WITH_PORT is defined in my environments.

Still no success. So I escalate... Thanks!!

@kzrl
Copy link

kzrl commented Feb 19, 2012

I'm also having this problem. It appeared on my development copy (I think) after I included Stringex to create pretty URLs.

I'm not getting it on the production server though.

@isaacsanders
Copy link
Contributor

Is this still an issue? If so, what branch of Rails (3-x-stable, master)?

@ndemoreau
Copy link
Author

I haven't got it anymore for weeks so, I guess we can close it. Thanks!

@sumkincpp
Copy link

Problem still arises with latest Rails on model creation/update

Redirected to http://localhost:3000:3000/change_world_projects/4
Completed 302 Found in 2202ms (ActiveRecord: 106.0ms)
[2012-10-28 21:53:44] ERROR URI::InvalidURIError: the scheme http does not accept registry part: localhost:3000:3000 (or bad hostname?)
C:/Ruby193/lib/ruby/1.9.1/uri/generic.rb:1202:in rescue in merge' C:/Ruby193/lib/ruby/1.9.1/uri/generic.rb:1199:inmerge'
C:/Ruby193/lib/ruby/1.9.1/webrick/httpresponse.rb:220:in setup_header' C:/Ruby193/lib/ruby/1.9.1/webrick/httpresponse.rb:150:insend_response'
C:/Ruby193/lib/ruby/1.9.1/webrick/httpserver.rb:110:in run' C:/Ruby193/lib/ruby/1.9.1/webrick/server.rb:191:inblock in start_thread'

@steveklabnik
Copy link
Member

@sumkincpp what exactly did you do to make this appear?

@sumkincpp
Copy link

@steveklabnik actually nothing unusual, just generated a new scaffold.
Now it's gone somehow but don't know exactly how - maybe after server restarting, maybe after changing routing options to its defaults :resource and after avoiding of devise usage.

Sorry for an issue, probably there may be no a bug, but I'll look carefully to my code and I'll report if it will arise again

@guilleiguaran
Copy link
Member

I'm adding this to my list, I will review soon

@ghost ghost assigned guilleiguaran Oct 28, 2012
@guilleiguaran guilleiguaran reopened this Oct 28, 2012
@steveklabnik
Copy link
Member

Hey @sumkincpp !

We can't reproduce this at all, and it seems you can't, either. Therefore, I'm giving it a close. If you can post a reproduction, please do so, and I'll try to fix it. But until then, there's nothing I can do.

@mayank-s
Copy link

mayank-s commented Dec 7, 2012

Hi

I am using rails 3.2.6. I have defined route in route.rb for facebook connect like this.

get ':provider/connect' => 'authentications#connect', as: 'connect'

when I try to get connect_url , its giving me the path "http://localhost:3000:3000/facebook/connect"
but when I try in rails console , it gives me the correct path "http://localhost:3000/facebook/connect"

Can anyone help resolving the issue

@steveklabnik
Copy link
Member

@mayank-s can you upgrade to 3.2.9?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants