I am trying to make GET request to my API endpoint and when I do the request from another server to the API I see this strange error (on the API):
170125/230803.439, [log,connection,client,error] data: {"bytesParsed":0,"code":"HPE_INVALID_METHOD"}
What does this error mean?
I am sorry I did request on https:// I should have done it on http:// instead
Related
So let's start with little info in the beginning.
I have nodejs server side app and client app on angular. I send only get requsts to server app just to read data from database. When i started my apps on local machine they were working pretty well. But when i deployed them to server i got such error : (below in screen)
screen with error from angular
So, i added cors support in server app and add Allow Headers. code in nodejs
But it doesn`t help. When i post "GET" request i get my allow headers in response header and my data that i need in body.
screen with response headers in postman
screen with response body in postman
Server - apache. One interesting thing that server app works good with http protocol and when i am using htttps get this errror error with https
But angular works on https.
In node.js express, if I get a request with an undefined body I would like to log what the http protocol text was so that I can figure out what went wrong. I don't want to flood my logs with every single request made to the server just the one that comes up undefined.
I want to POST the data from body to mongodb but when i use CORS then i am not able to post the data , GET method in working. What configuration we have to make in CORS middleware
This error and resolution came up as the first result of my google query using your error message and expressjs Cannot POST / error using express
This is my stack:
Frontend server: Node + ReactJS (f.com)
Backend server (API): Golang (b.com)
I'm doing this in development environment where I use create-react-app to run my frontend server via npm start command. I want to perform authentication using SSO served at sso.example.com/login. Ideally whenever there's a request to the Backend server without proper authorization, it will be responded with HTTP 302 Redirect to the SSO page. So the sequence is:
ReactJS sends GET request to b.com/users
Golang responded with http.Redirect("sso.example.com/login")
ReactJS app gets CORS error from sso.example.com of which I don't have control of adding Access-Control-Allow-Origin:* respond header
How can I redirect my GET request successfully?
In your case, it would be easier to do the redirection in browser on the client side, so you won't have CORS issues (because you are accessing it from the SSO website url directly).
You can either do it with react, which is complicated: Programmatically navigate using react router V4
Or do it with window with plain JavaScript, which is easy but might cause problems with browsing history:
window.location.href = "https://www.example.com";
https://appendto.com/2016/04/javascript-redirect-how-to-redirect-a-web-page-with-javascript/
I have app engine web service deployed. I have suddenly found, once clicked service name (default) link in services section of app engine, it redirects me from https://myapp-api.appspot.com/ to https://version-1-dot-myapp-api.appspot-preview.com/.
Having client application using axios node js lib (running on http), i found it giving errors trying to do POST request from client (http) to myapp (https). My app does support accepting ajax calls setting Allow-Control-Allow-Origin header. GET requests work fine.
POST request gives: UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 8): Error: Request failed with status code 400
If i replace API url from the original one to https://version-1-dot-myapp-api.appspot-preview.com/, it works.
Any idea why? What am i doing wrong? Should i permanently replace URL to preview one? Why POST request for short URL throws an exception?
Have this confirmed by Google support. Preview are the url`s of services running in a new - flex environment.