I have a MERN app where I use REST API to communicate with DB, I can not send API requests when I'm in localhost but f.e. GET method to https://jsonplaceholder.typicode.com/posts works fine as well as on production. When I checked out this project on other laptop it works. In my laptop after making login request i'm getting this:
post http://localhost:3000/login net::err_empty_response
In my .env i didn't write
MONGODB_LOCAL=mongodb+srv://yourname:#cluster0.qbasi.mongodb.net/?retryWrites=true&w=majority
Related
I have been trying to implement the Node.js client for Umbraco headless. I have done the following:
Set up Umbraco headless via my Umbraco cloud subscription
Implemented a simple app in Vue.js
Copied the example code from https://our.umbraco.com/documentation/Umbraco-Cloud/Headless/Headless-Node-Client/
when I run this code (via my localhost:8000) I get an authentication error
https://{MyUmbracoCloudUrl}/umbraco/rest/oauth/token 400 (Bad Request).
My config has the correct domain name for the cloud instance and the correct user name an password.
I get a 400 response from https://{MyDOMAIN}/umbraco/rest/oauth/token.
Does anyone have any ideas? I am not sure if this is a cors issue becuase I am trying to run this from my local host?
Cheers
L
My locally running rails app (on localhost:3000) responds to requests in the browser or from curl, but is not responding to requests from the desktop postman client, which immediately gives the generic "Could not get any response". Any idea what could be causing this?
For this you can use NGROK. It provides you a tunnel which can easily be used with postman or anyother such service. Download the library from here and run the tunnel as
./ngrok http 3000
or you can use lvh.me:3000 if your request is from same machine.
I am trying to get started with Ember Data and immediately ran into this problem were the browser sends a OPTIONS request before the actual request.
The development backend I am trying to communicate with is a rails 4.2 server running on my local machine (started with rails s -b 0.0.0.0 )
I currently use this api to communicate from both an android and an ios app. My end goal is to provide an Ember app in addition to the existing rails UI, but if I have to replace it and only have the Ember UI, that will be OK.
I did some reading on CORS and I think at at least understand what it is trying to do. If I understand correctly, the browser sees the Ember app as having been served by a server other than the one that requests are being made to and because of this asks the server if this is OK.
So my questions are:
Will I be able to deploy my ember app to the real server such that these CORS OPTIONS requests are not needed? (ie, I assume a rails app can deliver an Ember app to the browser and the browser will see the source of the script as being the same as the target of the request and not require the prefight requests)
How do I get this to work in development? I see there is a --proxy option on the ember s --proxy, which seemed like it was supposed to be the solution for this, but I have not been able to get it to work
When I navigate to the server url I am trying to access http://localhost:3000/api/v1/users rails logs the following response:
Started GET "/api/v1/users" for 127.0.0.1 at 2016-04-17 10:02:01 -0400
Based on this, I think I have my Ember adapter set up correctly:
import JSONAdapter from 'ember-data/adapters/json-api';
export default JSONAdapter.extend({
host: 'http://127.0.0.1:3000',
namespace: 'api/v1'
});
Then I start the Ember server with this command:
ember s --proxy http://127.0.0.1:3000
The rails server is receiving the following request:
Started OPTIONS "/api/v1/users" for 127.0.0.1 at 2016-04-17 09:36:51 -0400
Which fails because I don't have a route for that (and don't think I want to either).
If you use --proxy you should not override your host!
The ember app should make all request to the current endpoint (probably localhost:4200) and the development server will redirect the requests to the backend.
If you:
Want to serve your ember app from your backend server in production, and
want to use --proxy in your development enviroment
don't set host on your adapter and just have fun. If you set host, ember will sent the data directly to this host, and not to your development server, resulting in a CORS request.
I'm working on an app the requires a log-in by using oauth mechanisms from LinkedIn, Twitter, Google.
On the common meteor server this authentication method works fine.
However, I recently deployed the meteor server on my own server, and I get an authentication error when I try to log in. I tried linkedin and twitter and receive the same error, so I guess something is wrong on my server.
The error is in a browser window:
The requested URL /_oauth/linkedin was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.22 (Ubuntu) Server at exomodal.com Port 80
The meteor server is at port 3000.
Any ideas how to resolve this issue?
Thanks in advance
As far as I know, in Google, it asks for a redirect url and an origin url. During development, you registered these as localhost:3000/. But when you deploy, you are not using localhost anymore. Update these URLs in your "API console" (That's what they call it in Google) if any exists. As far as I know, Google and Facebook requires some sort of url registered.
Also, API configurations (client/consumer id and secret) are usually stored in the DB. Upon deploy, you don't usually ship your development DB, leaving behind the configurations which were on your development machine. What we did was to hard-code these into the server code, so that every time the server is restarted or redeployed to a "clean server", it inserts those configs to the DB.
I am trying to publish my SilverLight application to the web and I keep getting "An error occurred while trying to make a request to URI "http://localhost:2898....".
I've changed the ServiceReferences.ClientConfig to point to the web address but the app still keeps on trying to connect to localhost.
I've opened the application in FireFox and took a look at the firebug log and it says: -
clientaccesspolicy.xml 404 Not Found localhost:2898
crossdomain.xml 404 Not Found localhost:2898.
The silverlight app is accessing the web service in the same domain, I just don't know why it is still trying to connect to localhost.
Any help appreciated.
Steve
Two things come to mind, but check your "c:\windows\system32\drivers\etc\hosts" file and make sure ure local computer name or ip isnt mapped to localhost or the network machine isnt mapped to localhost for whatever strange reason.
Is the Silverlight app And WCF Service hosted on your localmachine, or are you accessing a server on your local network?
Just open the hosts file (C:\windows\system32\drivers\etc) and uncomment the following line (remove # from the beginning of the line): 127.0.0.1 localhost
Then save it, it should work.