Pull request previews redirecting

Hi all,

I’ve got a develop branch where all of our code review and testing is happening. My service is able to create PR previews no problem, but when anyone goes to access the code for that PR it redirects to the default onrender.com url. The main reason we moved to Render was to do high fidelity testing in pull requests and right now it’s impossible because of these redirects. Any insight into what could be happening here?

Video for reference Loom | Free Screen & Video Recording Software


Is it possible that there is something in your code that is redirecting to the main URL? Render shouldn’t be redirecting to the main URL when you access the pull request preview.

Yea, that’s what I thought initially as well but I assumed the redirect was coming from the controller level. I just did some more digging and it looks like we’re using Rack::CanonicalHost in the Rails middleware config which might be the culprit (I didn’t put it in initially so it’s purpose is unclear). If we do still have to use it, I imagine using the ignore option with a regex looking for /pr-{\d}+/ would suffice?

We wound up taking out canonical. It was added as part of Thoughtbot’s suspenders scaffolding framework and never really necessary. Hopefully this little thread will be helpful to anyone else working in legacy codebases :sweat_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.