Cloud run can't handle POST method - node.js

I just deployed an application into cloud run, but the application running in cloud run can't handle the request in the form of POST method and always returns 404 not found. After I checked the log, whatever request was given it was always translated into the get method. What should I do to prevent the given method from being translated like that?
the log:

Notice the HTTP 302 response on your POST. That means the client is being instructed to go to a new Location. Your client is then converting the POST into a GET and making another request at the new location.
Cloud Run only supports HTTPS. Your POST request is being sent to an HTTP endpoint. The Cloud Run frontend will automatically redirect the client to the HTTPS endpoint.
Change your request from using HTTP to HTTPS.

Related

Which request params can be used to tell if a request is coming from Postman vs NodeJS server?

I am running two identical API requests to a 3rd party API -- one in postman and the other in NodeJS. The API responds with different set-cookie headers in Postman vs NodeJS.
I've tried:
Copying the headers from Postman headers tab into my nodejs request headers.
Copying headers from the Postman console logs into my nodejs request headers.
Copying Postman's auto-generated axios code.
node-fetch instead of axios.
Turning various settings on/off in Postman.
Every time, the API request in Postman responds with a different set-cookie header than NodeJS. The postman request is receiving the correct session token while the NodeJS request is not.
The API server can somehow tell the difference between the two environments, but how?
Is postman running on a headless browser so that it can "fool" a server checking for browser runtime?
Is postman a true "curl" while nodejs requests are not?
Given that the request headers and body are the same in both requests, which variables might be used to differentiate between a postman request and nodejs request?
I'll answer this myself, for anyone who comes here searching for answers. Apparently, Postman uses some magic configuration to make requests from the browser while bypassing CORS issues.
They call it the "Postman Agent". It seems like it's probably a local proxy in front of a headless browser with CORS turned off (or something along those lines).
You can read about it here: https://blog.postman.com/introducing-the-postman-agent-send-api-requests-from-your-browser-without-limits/
In my case, the issue wasn't caused by a difference between the requests. It was caused by the way the responses were handled. Postman was showing cookies received in an initial 302 response, and then following the redirect. The NodeJS request was following the redirect but not showing the initial 'set-cookie' header in the final response. As soon as I set redirect: 'manual' in nodejs, I could see the correct headers from the initial 302 response.

Is there an Acumatica rest API endpoint that I can use to test if there is a connection

I would like to build an integration using the Acumatica REST API. However, before logging in or anything. I would like to know if there is a way to test that the server is up and running.
I've tried logging in and I looked at the swagger.json to look at all the endpoints but I think they require to be logged in.
I would expect a 200 response when the server is up and a 500 when the server is not. 5XX if there is server issues and an error if it is completely down.
There is no Test function that I know of. I would recommend doing a HTTP GET request on the endpoint URL. If the request succeeds it will return the WSDL schema with 200 success code.

Meteor default http auth

I have a meteor app which makes HTTP calls to some server with basic auth.
Now I want to use a modifier (axios provides interceptors which can modify the requests before sending them) such that on the basis of url, I should be able to add authorization headers.
Eg:
HTTP www.a.com/route1
HTTP www.b.com/route1
HTTP www.a.com/route2
What I want to accomplish is, whenever a request is made to www.a.com, I need to add headers.
I cannot do it manually for each request currently being sent as there are hundereds of requests being sent from different modules of the app.
Already thought of writing a wrapper around meteor's HTTP but any better option like interceptors?

NodeJS spam GET - REST API

I'm new to this API, node fun stuff.
I just setup my node application for a school project and hooked it to a domain. Already it's showing some weird spam GET commands, should I be worried? Is it the server that is getting redirected to those spam sites?
Image to explain:
https://i.gyazo.com/a21b0acf9e3749f7ebabb2d1e6fed4d6.png
- Do not enter the link from the console.
Are these logs being created by your server code? I'm assuming they are, in which case, it is showing the requests being made to the server, the request method (GET,POST,PUT,etc.), and response codes per request that were sent from your server back to the requester.
I'm also assuming these logs are coming from your server code thats deployed on a machine and hooked up to your domain name, in which case, it means that requests were made at
{your_domain_name}/assets/title.png (http status code - 200)
{your_domain_name}/status (http status code - 200)
{your_domain_name}/w00tw00t.at.ISC.SANS.DFind: (http status code - 200)
/assets/title.png, /status, /w00tw00t.at.ISC.SANS.DFind: are all called paths and are the destination at which a requester would communicate with your server. Your server code should expose "endpoints" that requesters can interact with - often a SOAP or REST API.
If I've made too many assumptions or you have more questions I'll be happy to adjust or add input.

Issue on sending request through a proxy server

I am facing an issue on sending http request using wininet api using when the request is sent through a proxy server.
I have an mfc application which sends a requests to a server.
for sending request is use
HttpSendRequest
function of wininet.
I need a file to be uploaded using this. for that 3-4 requst has to be sent related to each file.
When there is a proxy i cant upload more than 3 files at a time.
After that the requests is not sent properly.
Once it is blocked all the requests sent after that doesn't get proper response(some exception occurs).
I have done adding proxy credentials using
InternetSetOption(hConnect, INTERNET_OPTION_PROXY_USERNAME, (LPVOID)lpUname, nUnameBuffer);
InternetSetOption(hConnect, INTERNET_OPTION_PROXY_PASSWORD, (LPVOID)lpPswrd, nPswrdBuffer);
when the application is restated then its ok for the next 3 files.
also its working fine if the proxy settings are disabled.
Any one know why this occurres?
is there any limit for request using wininet functions under a proxy?
please help how to solve this issue.
hellpp me plzzzzz
thanks in advance.
The MS Support article "How To Handle Proxy Authorization with WinInet" suggest that you need to respond to HTTP_STATUS_PROXY_AUTH_REQ with adding authentication data and re-sending the request.

Resources