Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP 406 Not Acceptable #91

Open
dekhaus opened this issue Sep 1, 2015 · 1 comment
Open

HTTP 406 Not Acceptable #91

dekhaus opened this issue Sep 1, 2015 · 1 comment

Comments

@dekhaus
Copy link

dekhaus commented Sep 1, 2015

Hi All

I have an AngularJS app backed by a Rails api app (3.2). I'm trying to add a mobile web interface to my AngularJS app and am having trouble communicating with my Rails api backend when using a mobile user-agent (NOTE: when the user-agent is for a 'normal' desktop - everything works great). Some additional details may help ...

The way my app is setup (in development) is that the AngularJS app is served on port 9000 and the Rails api backend is served on port 3000. So I launch my Angular app at http://localhost:9000. The Rails api is accessible at http://localhost:3000/api.

Let's say I have a motd (message of the day) endpoint that my Angular app calls. This works today. I can launch the AngularJS app at http://localhost:9000 and see my app's homepage. When using the default user-agent I can directly access the motd data at http://localhost:3000/api/motd and get a normal response.

However - when I switch my user-agent to be one corresponding to an iOS device - I get a HTTP/1.1 406 Not Acceptable' error. I'm using Rack-Cors and its configured as follows (in config/application.rb) ...

config.middleware.use Rack::Cors do
  allow do
    origins '*'
    resource '*', :headers => :any, :methods => [:get, :post, :options]
  end
end

Any help would be immensely appreciated.

Thanks
Dave

@cyu
Copy link
Owner

cyu commented Nov 15, 2017

@dekhaus Are you using the latest version of the gem? There is an issue with Chrome not liking localhost when a wildcard is used for the origin (https://bugs.chromium.org/p/chromium/issues/detail?id=67743), could that be your issue here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants