Note that there are some explanatory texts on larger screens.

plurals
  1. POMy Rails page_cache is attaching someone else's domain to links, how can I stop this?
    text
    copied!<p>Let me try to explain what the situation is as thoroughly as I can see it.</p> <p>I have a Rails app using page caching for a specific part of the site. When looking through Google Analytics I noticed my own domain as a referrer which I found odd. Upon further investigation I discovered that when I go to one of those pages with my domain as the referrer, the links point to a different domain name but renders the page fine. For example:</p> <p>I'm on domain.com. I go to domain.com/someones_profile, and when I hover over any links it will say anotherdomain.com/someones_profile/about. Now, if I click the link, it'll take me to anotherdomain.com/someones_profile/about yet it's my page being accessed on my server (logs verify it.)</p> <p>I tested this out by taking one of my unused domain names and changing the A record to my server's IP. Then I cleared the page cache directory and visited a cacheable page using the domain I just set up, domain2.com/someones_profile, and it cached the links as domain2.com/someones_profile.</p> <p>Hopefully this explanation made sense. The domain that is "infiltrating" my cache belongs to someone I don't know, and the intent doesn't seem in any way malicious, but I was wondering if Rails has any sort of built-in methods to circumvent something like this. Something like forcing page_cache links to use a specific domain rather than whatever the referrer domain is.</p> <p>Any help would be appreciated, I would prefer to use built-in Rails method than to write something myself, maybe/maybe not because I'm lazy.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload