Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8012507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:21:06+00:00 2026-06-04T19:21:06+00:00

I have a sinatra app running on heroku. My problem: I always get redirected

  • 0

I have a sinatra app running on heroku.

My problem: I always get redirected to production environment (https://apps.facebook.com/myapp/) when I go to localhost (http://localhost:5000/). So I can’t develop locally anymore.

I suspect that the custom google analytics I added has something to do with it, see below (source: . http://www.savio.no/blogg/a/104/how-to-track-facebook-iframes-with-google-analytics). It

<script type="text/javascript">
// This script is provided AS IS without warranty of any kind.
// See http://www.savio.no/blogg/a/104/ for more information.
// Smacked together by Eivind Savio May 2011

var FacebookURL = 'http://www.facebook.com/YourFacebookPage?sk=app_123456789';

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXX-X']);
_gaq.push(['_addIgnoredRef', 'static.ak.facebook.com']);

// If Google Analytics is loaded and this page isn't framed inside our Facebook URL, frame the page.
if (_gaq.push && self.location == top.location) {
// Create a fake URL that we can filter in Google Analytics. This pageview also sends the traffic source data to Google Analytics.
_gaq.push(['_trackPageview','/facebook/campaign-tracking/']);
// Tracking done, let's frame the page
setTimeout(top.location.href = FacebookURL, 200);
} else if (self.location == top.location) {
// If Google Analytics doesn't load within 2 seconds, refresh and frame the page anyway. People dislike waiting. Change the time if you like.
setTimeout(top.location.href = FacebookURL, 2000);
} else {
// The Page is Framed. Let's track it.
_gaq.push(['_trackPageview']);
_gaq.push(['_trackPageLoadTime']);
}

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

So I removed it, but heroku still uses it, see below in the network console output, line 3. Whats going on here, is it a cache that doesnt get deleted? Any ideas?

[13:12:16.817] GET http://localhost:5000/ [HTTP/1.1 200 OK 395ms]
[13:12:17.330] GET https://apps.facebook.com/myapp/ [HTTP/1.1 200 OK 782ms]
[13:12:17.357] GET http://www.google-analytics.com/__utm.gif?xxxxxxxxxxxxxxxx [HTTP/1.1 200 OK 14ms]
[13:12:17.500] syntax error @ http://localhost:5000/:108
[13:12:18.326] POST https://xxxx.herokuapp.com/ [HTTP/1.1 302 Moved Temporarily 952ms]
[13:12:19.200] GET https://xxxx.herokuapp.com/ [HTTP/1.1 200 OK 734ms]
[13:12:19.827] GET https://xxxx.herokuapp.com/stylesheets/screen.css [HTTP/1.1 200 OK 262ms]
[13:12:19.829] GET https://xxxx.herokuapp.com/stylesheets/mobile.css [HTTP/1.1 200 OK 398ms]
[13:12:19.831] GET https://xxxx.herokuapp.com/javascripts/jquery-1.7.1.min.js [HTTP/1.1 200 OK 1032ms]
[13:12:20.093] GET https://xxxx.herokuapp.com/stylesheets/reset.css [HTTP/1.1 200 OK 135ms]
[13:12:20.096] GET https://xxxx.herokuapp.com/stylesheets/base.css [HTTP/1.1 200 OK 263ms]
[13:12:21.026] GET https://xxxx.herokuapp.com/images/house_suburb.jpg [HTTP/1.1 200 OK 308ms]
[13:12:21.051] GET https://xxxx.herokuapp.com/images/logo.png [HTTP/1.1 200 OK 295ms]
[13:12:21.109] GET https://www.facebook.com/dialog/oauth?api_key=xxxxxxxxxxxxxxxxcode&sdk=joey [HTTP/1.1 302 Found 192ms]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:21:07+00:00Added an answer on June 4, 2026 at 7:21 pm

    The problem stems from this:

    } else if (self.location == top.location) {
    // If Google Analytics doesn't load within 2 seconds, refresh and frame the page anyway. People dislike waiting. Change the time if you like.
    setTimeout(top.location.href = FacebookURL, 2000);
    }
    

    Basically you’re saying “if the page is not framed, redirect to the FacebookURL”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a few machines in production that are running a Sinatra app
I have a production ruby sinatra app running on nginx/passenger, and I frequently see
I have simple Sinatra app. web.rb: require 'sinatra' get '/' do Hello end Gemfile:*
I've been trying to get a simple hello world web app running on Sinatra.
I'm building a Facebook app called Lovers , using a Sinatra app on Heroku
I have a sinatra app running locally and awhile back I ran into an
I have a Sinatra app I plan on hosting on Heroku. This application, in
Real World Problem: I have my app hosted on Heroku , who (to my
I have a Sinatra app that, boiled down, looks basically like this: class MyApp
I have a Sinatra app, that uses omniauth which constantantly gets this error attack

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.