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 6324891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:47:25+00:00 2026-05-24T16:47:25+00:00

I have two local rails apps that I would like to talk to each

  • 0

I have two local rails apps that I would like to talk to each other for testing purposes… one is running on port 3000 and the other on 9292.

But when I make an ajax request from localhost:3000 to localhost:9292 I keep getting this issue:

Origin http://localhost:3000 is not allowed by Access-Control-Allow-Origin.

Any idea on how to fix this?

I am using a simple Sinatra app to receive (for testing purposes ONLY) JSON requests. Below is how I got two rails apps talking to each other on localhost (one on port 3000 and the other on port 9292)
Working Code

before do
  headers['Access-Control-Allow-Origin'] = '*'
  headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'
  headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version, X-CSRF-Token'
end

after do
  headers['Access-Control-Allow-Origin'] = 'http://localhost:3000/'
end

Hope this helps!

  • 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-05-24T16:47:27+00:00Added an answer on May 24, 2026 at 4:47 pm

    Cross-domain AJAX is generally not allowed for security reasons. JSONP is an option if you are able to use it. If not, you can use something like flXHR to get around this restriction.

    Best of luck!

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

Sidebar

Related Questions

I have two (+) systems on a local network running an AIR application that
I have two resolvers configured. One is the company repo, the other a local
I have two branches: local branch (the one which I work with) remote branch
Say I have two web servers, one local development and one live. Under SVN
I have two rails apps on separate virtual servers, but in the same facility.
I have two machines: remote and local . I want remote to be my
in /usr/local i now have two mysql folders: mysql-5.1.34-osx10.5-x86 mysql-5.1.37-osx10.5-x86_64 is it possible to
I have two git repositories: report.git (Master on remote location) cloned.git (Local) I lost
Suppose you have two linked servers called Local and Remote respectively. Is there a
struts 2.0.11 - Currently I'm in my local machine and have two different web

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.