Why do we get HTTP 503 service unavailable? [closed] - java

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I know that http 503 means that the "server is unavailable" as mentioned in mozilla docs. But, if the server is unavailable or offline, then how is that server able to return a 503 response ? Is the client getting timed out and assuming a 503?
UPDATE -
I learned that there is often "middle man" such as a load balancer which gives the 503 when the backend is down. So, what if there is no middle man? Would you get an http 408 in that case?
PS - Java and Python tags are added only to get more attention from developers who are likely to know the answer to this question.

50x errors are for application errors. This means that if you have for example Apache2 or Nginx web server and that server communicate with backend application which is currently unavailable (down, starting, freezed, etc) you get this 503 error.
YOU -----> Apache2/Nginx web server ------> app backend = you will get 200
response.
YOU -----> Apache2/Nginx web server --XXX--> app backend = you will get 503
error.

Related

Access Denied (authentication_falied) Issue in Java web application [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 days ago.
Improve this question
Your credentials could not be authenticated: "Credentials are missing.
You will not be permitted access until your credentials can be
verified.
This is typically caused by an incorrect username and/or password; but
could also be caused by network problems.
Above error is intermittently appearing in a Java web application hosted in Tomcat on a Windows 10 machine that communicates to a internet server through a proxy server. The proxy server requires authentication which is passed by the application code. The Windows machine is in an Active Directory domain.
The surprising part is that whenever such error occurs logging into the Windows machine resolves the issue.
Looking for a permanent solution where the application runs without having to log into the Windows machine.
I tried keeping the machine power mode active, so that it doesn't go into sleep mode, but still issue not resolved.

HTTP Proxy - upstream connect error or disconnect/reset before headers. reset reason: protocol error [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 months ago.
Improve this question
I created two spring boot application one serving APIs and another acting as a HTTP proxy to that API (which internally uses CloseableHttpClient to bounce on the another url, fetches the data adds cors and pushes back the response.)
I deployed both into GCP cloud run but when I run it locally it works but not when using the cloud run endpoint.
It resulting in error like this -
upstream connect error or disconnect/reset before headers. reset reason: protocol error
What it is I am messing up ?

Configure JMeter as TCP server to receive messages? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have ReST service, which calls a method to send the generated information to another endpoint using TCP, is there any way that with Jmeter that when I send a ReST request and should be able to host TCP server in my JMeter to receive the response sent when service called?
If you need to have a TCP server in JMeter you can get one using JSR223 Sampler and the following minimal code snippet:
def socketServer = new ServerSocket(1234)
while (true) {
socketServer.accept { socket ->
socket.withStreams { input, output ->
log.info("Received message: ${input.newReader().readLine()}")
}
}
}
it will start the TCP server on the port 1234, listen to incoming connections and printing the received data to jmeter.log file
More information on Groovy scripting in JMeter: Apache Groovy - Why and How You Should Use It
If you're receiving HTTP, not TCP you might rather want to go for HTTP Mirror Server which is listening to incoming HTTP connections and returns the received data

Java Socket Programming LAN Messenger [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am working on Lan Messenger, how can I check if somebody else's system has LAN plugged in?
Means, is that person Online?
Also, our hostel has LAN, and I've tried running the client server program a lot many times, but it runs fine on my system (2 clients on the same machine as server) but it doesn't run when server and client are on different machines.
The code is perfectly fine.
What could be the reason? Any special Firewall settings to be changed for allowing packets?
I'm creating a chat server using sockets right now and the way I'm doing it is I have every user query the server about every 20-30 seconds. The server keeps track of the last time a user "refreshed" itself. If a user's gone a certain time period or more without doing so, then the server tells anyone trying to contact this user that they are offline.
Here is a VERY good reference to work off of. Take a look at the Server folder for the server-side and the src folder for the client-side:
https://code.google.com/p/simple-android-instant-messaging-application/source/browse/trunk/#trunk%2FServer%253Fstate%253Dclosed
If you only want to communicate within a LAN, then the socket implementatation in that link is defininitely what you want. If you want to communicate globally( a user in 1 LAN to a user in some other LAN ) then you'll want to redesign it a little so that your server socket is actually on some server accepting client connections. The current implementation creates a server socket within each client and accepts connections from other clients trying to communicate with it. This design breaks due to NAT routers (for reasons I'd rather not explain unless you really want to know).

Java HTTP proxy server [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I need to implement a HTTP proxy server application which will proxy requests from multiple clients to a remote server.
Here are the steps:
Client forward request to proxy
Proxy forward request to server
Server returns request to Proxy
Proxy returns request to Client.
I'm just not sure how I should implement this proxy. My first thought was to implement a tomcat application which uses jersey / apache httpclient to forward the request to the remote server and return the response back to the client ?
Is there a better way to implement such a proxy server ?
The proxy would need to handle multiple threads.
You can't implement it as a servlet, and there is no reason to use any form of HTTP client.
A featureless proxy server is a really simple thing:
Accept a connection and start a thread for it.
Read the request from the client up to the blank line.
Extract the GET or CONNECT command or whatever it is and connect to the named host.
If that fails, send back an appropriate HTTP error response, close the socket, and forget about it.
Otherwise start two threads to copy bytes, one in each direction. Nothing fancy, just
while ((count = in.read(buffer)) > 0)
{
out.write(buffer, 0, count);
}
When one of those sockets reads an EOS, shutdown the other socket for output and exit the thread that got the EOS.
If the socket that was the source of the EOS is already shutdown for output, close them both.
Or use Apache SQUID.
Check out LittleProxy -- it has built-in classes for incoming and outgoing requests; you can just write your code similarly to how you would handle a HTTP request in a servlet.

Categories