error using direct path url vs ok when navigating by mouse

89 views
Skip to first unread message

fugee ohu

unread,
Oct 18, 2019, 4:26:31 AM10/18/19
to Ruby on Rails: Talk
On one of my sites (in production) if I navigate to https://<sitename>/set_locale/ko the browser doesn't load the page but if I'm on the site and I click the  link for that url it works fine I was notified about the error by GSC

Colin Law

unread,
Oct 18, 2019, 5:57:55 AM10/18/19
to Ruby on Rails: Talk
On Fri, 18 Oct 2019 at 09:26, fugee ohu <fuge...@gmail.com> wrote:
On one of my sites (in production) if I navigate to https://<sitename>/set_locale/ko the browser doesn't load the page but if I'm on the site and I click the  link for that url it works fine I was notified about the error by GSC

You haven't told us what you see in the rails log when you do that.  I am sure you will have looked there before asking.
Not that you have actually asked a question, just told us that you have this interesting occurrence.
Also you haven't told us what is shown in the browser console when it happens.

Colin
 

fugee ohu

unread,
Oct 18, 2019, 2:33:16 PM10/18/19
to Ruby on Rails: Talk
Both browser console and log say 500 internal server error 

Colin Law

unread,
Oct 18, 2019, 5:07:25 PM10/18/19
to Ruby on Rails: Talk
Well that is why it doesn't show the page then.

Colin
 

fugee ohu

unread,
Oct 18, 2019, 9:20:34 PM10/18/19
to Ruby on Rails: Talk
It's not a page, it's a link to set_locale path It only changes the locale Does that help 

Ariel Juodziukynas

unread,
Oct 18, 2019, 9:22:09 PM10/18/19
to rubyonra...@googlegroups.com
Is the link doing a GET request or a POST request? make sure your route matches GET requests too.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsU1QbNV6i6XQGqbOmAauz-Q9o5wXwx1831%3D1dv4yEcaw%40mail.gmail.com.

fugee ohu

unread,
Oct 18, 2019, 9:32:47 PM10/18/19
to Ruby on Rails: Talk


On Friday, October 18, 2019 at 9:22:09 PM UTC-4, Ariel Juodziukynas wrote:
Is the link doing a GET request or a POST request? make sure your route matches GET requests too.

El vie., 18 oct. 2019 a las 18:07, Colin Law (<cla...@gmail.com>) escribió:
On Fri, 18 Oct 2019 at 19:33, fugee ohu <fuge...@gmail.com> wrote:


On Friday, October 18, 2019 at 5:57:55 AM UTC-4, Colin Law wrote:
On Fri, 18 Oct 2019 at 09:26, fugee ohu <fuge...@gmail.com> wrote:
On one of my sites (in production) if I navigate to https://<sitename>/set_locale/ko the browser doesn't load the page but if I'm on the site and I click the  link for that url it works fine I was notified about the error by GSC

You haven't told us what you see in the rails log when you do that.  I am sure you will have looked there before asking.
Not that you have actually asked a question, just told us that you have this interesting occurrence.
Also you haven't told us what is shown in the browser console when it happens.

Colin
 

Both browser console and log say 500 internal server error 

Well that is why it doesn't show the page then.

Colin
 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonra...@googlegroups.com.


  <li><span class="smaller-text"><%= link_to "한국어", set_locale_path(locale: "ko") %></span>


  get 'set_locale/:locale' => 'world#set_locale', as: 'set_locale'


   def set_locale
    I18n.locale = params[:locale] || "zh-TW"
    respond_to do |format|
        format.html { redirect_to request.referrer }
    end
  end

Ariel Juodziukynas

unread,
Oct 18, 2019, 10:08:41 PM10/18/19
to rubyonra...@googlegroups.com
You are using `redirect_to request.referrer` and referrer is nil if you enter the url by hand.

Use `redirect_back fallback: root_path` instead.

To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/401e2df8-b4dd-42fb-9721-39491be9bed3%40googlegroups.com.

Ariel Juodziukynas

unread,
Oct 18, 2019, 10:09:09 PM10/18/19
to rubyonra...@googlegroups.com
Sorry, `redirect_back fallback_location: root_path`.

fugee ohu

unread,
Oct 19, 2019, 7:26:12 AM10/19/19
to Ruby on Rails: Talk

Cool Thanks Can you tell me how do I get google to crawl my site in every locale? Just the way I'm doing it now? If not that would mean I should disallow those set_locale links in robots.txt?
Reply all
Reply to author
Forward
Message has been deleted
0 new messages