2 개의 응용 프로그램에서 bitly url을 사용하고 있습니다. 한 경우에는 내가으로 jQuery를 통해 사용하고 있습니다 :피어에 의한 연결 재설정 - Bitly를 사용할 때 SSL_connect 오류가 발생했습니다.
function get_short_url(long_url, login, api_key, func)
{
$.getJSON(
"http://api.bitly.com/v3/shorten?callback=?",
{
"format": "json",
"apiKey": api_key,
"login": login,
"longUrl": long_url
},
function(response)
{
func(response.data.url);
}
);
}
과 다른 경우에 나는 버전 1.0.2로 bitly 보석을 사용하고 있습니다. 이를 위해 나는 추가하고
보기 :
<%= f.input :link_placeholder, :as => :text, :label => false, :input_html => { :id => 'copy_link', :class => '', :value => "#{get_bitly_url(user_report_url(@user, @report))}", :rows => 2, :cols => 30, :maxlength => 490} %>
컨트롤러 :
def show
@report = Report.find(params[:id])
@bitly_url = get_bitly_url("#{user_reports_url}/#{@report.id}")
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @report }
end
end
def get_bitly_url(url)
if Rails.env.development?
return url
else
bitly = Bitly.new('myapp', 'R_e2pd1dca0442a20a2qwqw59156e3260d')
bitly.shorten(url).short_url
end
end
위의 (2)가 개발 모드에서 잘 작동 및 생산 모드 레일있다
와 나는 또한 아파치와 AWS EC2 인스턴스에 시도 Phusion을 사용하면 큰 작업을하고 있습니다. URL에 "https"라는 도메인 이름이 언급 된 주요 프로덕션 서버에서는 작동하지 않습니다.
에서errno를 :: ECONNRESET (피어에 의해 연결 재설정 - SSL_connect) :
이 내가 점점 오전 오류입니다
응용 프로그램/컨트롤러/reports_controller.rb : 342 :get_bitly_url'
쇼 '
app/controllers/reports_controller.rb:35:in
show에 언급 된 url은 위에서 언급 한 js 파일에서옵니다.
이 오류를 해결하는 데 도움을주십시오.
답변 해 주셔서 감사합니다. 나는 또한 bitly url을'https : //api-ssl.bitly.com/v3/shorten? callback =? '으로 대체했다. –
네, 할 수 있습니다 .... – venkat