502 (BAD GATEWAY) and 504 (GATEWAY TIMEOUT) in Wirecloud - fiware

Time ago we set up a PEP proxy to secure the API our widgets are using. All have being working correctly until today, that we are receiving a 502 Bad Gateway error code for every call going through the proxy.
We have checked the requests are reaching our server and it is responsing correctly to them. The parameters added by the proxy (x-nick-name, x-display-name...) are defined correctly too.
We have also checked the requests outside wirecloud and all go well: we get the token properly and use it in the subsequent calls without problem.
We do not know where this error comes from, any ideas?
EDIT 06/11/2015
After Alvaro's new setting we are receiving the following error in the response body:
{
"description": "Connection Error",
"details": "('Connection aborted.', error(104, 'Connection reset by peer'))"
}
EDIT 09/11/15
Today, the code received in the request's response is different: 504 GATEWAY TIMEOUT
{
"description": "Connection Error",
"details": "('Connection aborted.', error(104, 'Connection reset by peer'))"
}
EDIT 16/11/15
Answering to Mr. Alonso's question:
1.- If we request directly to the server, the response is correctly displayed in the application.
2.- Here you can see the logs from the PEP Proxy with the new line added. As you can see the request is redirected correctly but the info is not displayed in the app.

Seems that the problem is in the PEP proxy side.
I've checked using other tools like curl (I obtained the connection details from the server log). Making the same request using curl gives the same result than using WireCloud: connection reset by peer. Also, if I make the request without the X-Auth-Token header, your service responds with an 401 error code. This is important, because it means that there is not a communication problem between the Mashup portal and your server. I don't know why, but the PEP proxy seems to be crashing when making the authenticated request from the Mashup portal (the same command works executing it from my machine).
I suggest you to restart the PEP proxy. If the problem persist, please attach any available info about the crash from the PEP proxy logs.

You can check three things to give us more information:
Try to remove the PEP and send the request directly to your service.
Introduce a new log in PEP to print the headers of the response: line 41 of lib/HTTPClient.js, log.debug("Headers: ", headers);
Try to send a request to the root path (directly to the tomacat or apache)
If not perhaps we can talk in private to check more information

Related

OCI SDK For DotNet Hangs When Doing Requests

I followed the example in described by Oracle here: https://docs.oracle.com/en-us/iaas/tools/dot-net-examples/51.3.0/vault/ListSecrets.cs.html and when I try any of the commands it sends a request and receives a response back with a response code of 200, but it does nothing after receiving a response. It just hangs. And I also only have 1 Vault and 1 Secret in that Vault. The logs stop with the log:
Setting Property Value from Header
Has any experienced this issue before?
I tried checking if it was the authentication, tried googling and tried other services like the KMSVaultService. I am expecting to get a value back when I call the ListSecrets method and for it not to hang.
The solution was to update the dependency packages. After doing that it started to work again

Apacha HttpClient configuration

I'm currently using RestTemplate backed by Apache http client 4.5.6 in my web server for making http requests. My HttpClient configuration is as follows:
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
connectionManager.setMaxTotal(httpConfigurationProperties.getConnection().getMaxTotal());
connectionManager.setDefaultMaxPerRoute(httpConfigurationProperties.getConnection()
return HttpClients.custom()
.setDefaultRequestConfig(RequestConfig
.custom()
.setConnectionRequestTimeout((int) httpConfigurationProperties.getTimeout().getConnectionRequestTimeout().toMillis())
.setConnectTimeout((int) httpConfigurationProperties.getTimeout().getConnectTimeout().toMillis())
.setSocketTimeout((int) httpConfigurationProperties.getTimeout().getReadTimeout().toMillis())
.build())
.setRetryHandler(StandardHttpRequestRetryHandler.INSTANCE)
.setConnectionManager(connectionManager)
.build();
When I make a HTTP GET, once in a while i see this:
I/O exception (java.net.SocketException) caught when processing
request to {s}->: Connection reset
I have read in another post that this is caused by server(that I'm sending request to) closing the connection without informing client. And StandardHttpRequestRetryHandler was able to retry it. But HTTP POST methods are not retried because they are not idempotent operations. But is there a configuration that can avoid this connection reset in first place?
And I have tried using evictExpiredConnections and does not help. Will setting connectionManager.setValidateAfterInactivity(20000) help validating connection before using?
Before using apache http client I used SimpleClientHttpRequestFactory in RestTemplate and I never faced connection reset issues. Any help is appreciated

Heroku app: Error during WebSocket handshake: Unexpected response code: 200

I followed a tutorial on how to make a multiplayer tetris game, here is the repo:
https://github.com/Leftier/tetris
It worked just fine on localhost so I tried to deploy it in heroku (https://tetrixtest.herokuapp.com/ --ASD to move Q/E to rotate) but I get the following error:
WebSocket connection to 'wss://tetrixtest.herokuapp.com/' failed: Error during WebSocket handshake: Unexpected response code: 200
while trying to create the webSocket in this line (connection-manager.js line 14):
this.conn = new WebSocket(`wss://${window.location.hostname}:${window.location.port}`)
I don't know much about webSockets,
at first I thought that heroku was not able to handle websockets but that wasn't the case so I tried using the link directly as an argument instead of reading it from the browser but still the same issue.
I would like some clues/hints about why does this happens, I searched in google and github, but I only found issues related to socket.io
For me the solution was to turn on "Session affinity" by running this command heroku features:enable http-session-affinity
More info at https://devcenter.heroku.com/articles/session-affinity
Session affinity, sometimes referred to as sticky sessions, is a
platform feature that associates all HTTP requests coming from an
end-user with a single application instance (web dyno).

nginx modifying the jsonp response message

We are creating a web api application. In one of our API's if there are any validation errors, we are returning the error message in JSONP format. In the API Request URL user adds a query string parameter ?jsoncallback=xxxxxxxxxx like this.
On validation failure we are throwing a 400 bad request JSONP with response message in the below format:
xxxxxxxxxx({"error","error message"})
It is working good in all the environments, where there is no nginx. In our staging environment we have nginx configured.
Here it is modifying the output as below:
badrequest{"error","error message"})
Because of this our front end application is unable to read the response message.
Could you please let me know, what configuration setting of nginx could cause this problem?
Thanks in Advance
Venkat.
Actually the problem is not due to nginx.
It is due to IIS 7.5 in our staging server which is causing the problem.
Below configuration change in web.config has fixed it.
<httpErrors errorMode="Detailed" />

SMTP mail error

Hello i have some problem when using SMTP mail using PHP.
when i am use mail function that time always it shows
errore Like "Unable to find the socket transport "http" - did you forget to enable it when you configured PHP?"
How can i slove this problem at (Project is on Cpanle)
Kindly help me
It would help to see a code snippet.
The error message suggests that you are using fsockopen() and passing it an http URL instead of an hostname.
You may also have an http url somewhere else (in your code or a config file) that is passed to fsockopen() at some point. Make sure your smtp server hostname doesn't start with http://.