REST API random 404 error when a server is down on load balancer - rest

We have a REST based API project. The project is hosted in IIS on multiple servers on a load balancer.It works great except when a server goes down on the load balancer, we receive a 404 Bad Request error for few seconds and then it resolves itself. How do we resolve this? Are there any changes that need to be done in IIS or on the REST API project itself?

As far as I know, if you use IIS ARR's loadbalance there is no need to add the specail setting to check the server's status. The IIS ARR healthy test will auto send the request to check the server is work well or not. If the IIS ARR find the server is down or return error, it will not redirect the request to the server.
Besides, as far as I know, the 404 error means the page not found not the bad request. Normally, 400 is the bad request status code.
If you find a server is down in your server farms, I suggest you could try to access the server directly through the brwoser to know the details error message.
If the server return 404 error, that means your browser couldn't access the server, it is a network issue normally. You should check the DNS server setting or make sure the IIS web application is running.
If the server return 400 error, you should troublshooting according to the details 400 error message. Normall, it shows when the request contains the wrong header.

Related

PUT requests in Wildfly respond with 500

I have an app with a backend and a frontend that communicate with each other, and is developed on Wildfly.
When I make a PUT request from the backend to the frontend, these requests do not arrive and they return a 500 error. However, POST requests work correctly and do not generate problems.
I have checked the configuration of the wildfly, ficher or configuration server (standalone.xml), but I do not fall where the problem may be.
How can I fix this?
So you say when the backend sends a PUT request the response has status 500, while when the backend sends a POST request to the same URL the response has status 2XX?
That does not smell like a connectivity issue. It seems more that your PUT request gets blocked somewhere. Try to find out where that error 500 is coming from. It could be a proxy or firewall inbetween client and server, it could be even that Wildfly or the application are not configured to respond to PUT.

AWS Classic Load Balancer + EC2: web API requests returns 404

I have an AWS EC2 Jira instance running behind an AWS Classic load balancer. The site loads in the browser fine, but all API requests are returning 404 for some reason. It is not a Jira 404, but a generic 404 response with no body and minimal headers. Only response useful header seems to be Server: nginx.
Tried white-listing my client IP, opening up all ports, sending request to the LB and directly to the instance with proper security group settings, etc., but same 404 response is returned. I'm using Postman to test the API. I noticed when I load the EC2 instance directly in the browser, it redirects to the load balancer.
Returns 200 with HTML. Basic auth works, too.
GET http://jira (home page)
Returns 404:
GET http://jira/rest/api/2/issue/ticket-num (or any other /rest/ endpoints)
Where should I start looking to debug this 404 issue? I feel like I'm missing something basic. I'm not seeing any Jira configuration for setting up its rest API. I feel like perhaps it's a server configuration issue, although I've never come across manual web server configuration while installing Jira, so maybe on the AWS's side?
EDIT: still waiting to get ssh access to the instance, so I'll update as I get more info and access.
This HTTP 404 responses with very limited set of headers could be from the default (the bottom one) rule in ELB. I experienced similar issue getting HTTP 404 because instead of host header I set path and provided the host domain name in one of ELB rules. So the rule did not work and default rule returned 404 because there is no such path exists on the instance.
I would recommend to try to use Redirect to or Return fixed response options for default rule to check out if it goes to the default rule.

Can my Web Server Issue a Client Rest Request to another REST Server

I have a web server that handles configuration set-up for various IO devices. I need to get some data from a REST server that is running on a different server. Can that web server code issue a client REST GET command to a REST server running on a different server? I tried it but I get a http 500 error. The server code is failing on the REST server request code.
I am closing out this question. Yes, your server can issue http requests to other services. I was having another problem with a self-signed certificate and the error made it look like their was a problem with my http request service.

com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 401: Unauthorized

I am running a sample program on SOAP web service on ecplise with jboss.
In Web Service Tester, when I gave the wsdl url and clicked "invoke" button, i am getting the following error:
com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 401: Unauthorized
please help
I got to similar problem. Several things can go wrong.
1) If you are testing something, the system performing the testing could have blacklisted or non whitelisted IP.
2) If there is a mysql backend handling the request you might need to update the previleges for the mysql.

enable http-bind on openfire

I am trying to enable BOSH connection over Openfire so that i can create a XMPP client over a web. curretly i am testing it with the strophe.js.
the problem is when i try to fire following url in a browser i am getting
http://www.mydomain.com:7070/http-bind
following error
HTTP ERROR 400
Problem accessing /http-bind/. Reason:
Bad Request
Powered by Jetty://
here is my server setting , i saw few threads but they arent helpful
update
i have made a connection using strophe but i am getting following error in browser trance
its now working in my system.
i think your error encountered may actually be a configuration issue with the openfire.
It is designed to reply with HTTP 400 Bad Request if there is no element in the request. You can test this yourself by providing a element in your query.
Try the following URL in your browser:
http://www.servername:7070/http-bind/?<body rid="1"/>
In your update Strophe is sending OPTIONS HTTP requests which means that it is negotiating cross domain communication. Requests are painted red which means that this is failing for some reason. Probably misconfiguration.
There is a nice article about that here: http://metajack.im/2010/01/19/crossdomain-ajax-for-xmpp-http-binding-made-easy/
Otherwise, when Strophe does its regular BOSH communication it uses POST method.
Your setup is correct. The page the browser displays to you is also normal. Openfires BOSH component is not designed to work in a Browser with HTTP GET, only with BOSH clients like strophe. Try to connect with strophe.
You should use proxy to repost the request to the openfire server . Because, the js post cannot support cross domain.
Notes:
1.I use jsjac , but I think it's not important .
2.If you sure your config is right , please restart you openfire server . It's my experience .
If server is properly configured it should display
HTTP ERROR: 404
Problem accessing /http-bind/. Reason:
Not Found
Powered by Jetty://
The Bad Request was gone when I uninstall and reinstall Openfire as in
here.
Below works for me, i am pinging the openfire server after some interval so, clients remains alive...
i just append "/?<body rid='1'" with the server name and i don't have 400 bad request error.
XMPPconnection.sendIQ($iq({ to: XMPPserver+"/?<body rid='1'/>", from: CurrentUserJID, type: "get" }).c('ping', { xmlns: "urn:xmpp:ping" }));