module ActionDispatch::Http::URL

def server_port

def server_port
  get_header('SERVER_PORT').to_i
end