Are you trying to open an SSL connection to a non-SSL Puma? - puma

After working on getting a new project to work, I found that for some reason I couldn't start my rails server. I kept getting the following error:
HTTP parse error, malformed request: #<Puma::HttpParserError: Invalid HTTP format, parsing fails. Are you trying to open an SSL connection to a non-SSL Puma?>

I was able to solve this problem by clearing my browsing history, cookies and saved images.
Click ...
More tools
Clear Browsing Data
Delete everything since the beginning of time.

Related

Android Picasso not loading from LAN url

My simple web server is Python3 SimpleHTTPRequestHandler and
it works just fine. It runs in a LAN machine's picture folder and I have tested it
using a browser and entering a test URL such as:
http://192.168.1.111:8000/2020-02-09/test.jpg
However, that same URL will not load by Picasso.
It will load local pictures via the "file://".
As test, I have tested an internet URL and it also loads successfully.
So I have narrowed down the problem to the LAN address.
I have tried the android:networkSecurityConfig solution but it did not work.
I'm running out of ideas at this point and about to ditch Picasso and
load the images via ftp but did not want to get into managing efficient memory
management. Please advise...
I spoke a bit too soon!
I tried to bypass Picasso and use an asyncTask based on java.net.URL(lanUrl)
and saw the error in the debug window:
java.io.IOException: Cleartext HTTP traffic to 192.168.1.150 not permitted
So, that got me to
Cleartext http traffic not permitted and revisit the networkSecurityConfig solution.
Using the accepted answer, the error is now gone and Picasso loads successfully. I only wish it had produced that error message!
Thanks goes to Shafi Muhammed.

FineUploader Status 406 ASP.NET

I'm using fineuploader in a ASP.NET Web Application in order to upload files. The uploads are working in most cases. The problem is that the upload of a few files is not working, I'm getting status code 406 when the client sends the post request with the file's chunck.
I tried sending files with the same name,similar size and extension as the files that are not working and they worked so it doesnt seem to be an issue with the filename,size or extension.I couldn't find something in common between these files.
I configured the chunck size for 5MB but also tried chaging to 2 MB and 10MB but they also didn't work.
Here is print of the request, can someone identify the problem and how to solve it?
From the requests, it seems to be some problem with the cloudfront or IIS? I don't know much about this.
Edit:
Looking at the IIS logs I found this, it seems the user is '-' for the request that returned 406, is the cs-username '-' because of the 406 or is the request 406 because of the cs-username '-'? If it's the second, what could make the user be lost like this?
The error message 406 means either the mime type in your Accept request header is invalid for IIS or IIS server can't return data via the type in Accept header.
So please check whether IIS->World wide web services->Static Content has been installed. Please ensure the type in Accept header is also valid in IIS manager->site node->Mime Types.
Now that your client only accept application/json, please ensure your your code will return the correct reponse type.
If that's not working, please enable failed request tracing and post detail error messages in the FRT log.
https://learn.microsoft.com/en-us/iis/troubleshoot/using-failed-request-tracing/troubleshoot-with-failed-request-tracing

Auth0 Ruby on Rails TCP Error

I am using Auth0's Ruby on Rails API Sample as boilerplate to set up authentication with a new app. Everything is working up to but not including the "Test Your API with cURL" step on the second page of the instructions.
I have tried testing both with cURL and with Postman, and both times I receive the follwoing error:
Errno::ECONNREFUSED in PrivateController#private. Failed to open TCP connection to :443 (Connection refused - connect(2) for nil port 443)
The highlighted line of the error is the following: jwks_raw = Net::HTTP.get URI("https://#{Rails.application.secrets.auth0_domain}/.well-known/jwks.json").
I receive the same error when I clone the sample repo directly and attempt testing with my Access Token, so it seems that it is possibly an oversight or outdated code in their example rather than some error with my incorporation of it into my own app.
How do I resolve this?
Make sure the auth0_domain secret is set when you are passing it to the rails app.
If the value is empty, it will make your initial string an invalid URL, i.e. "https://#{Rails.application.secrets.auth0_domain}/.well-known/jwks.json" turns into "https:///.well-known/jwks.json".
In my case I was using an empty environment variable, which returned nil:
ENV['AUTH0_DOMAIN']
=> nil
Hope this answer helps you!

Error generating links on branch io

I am generating dynamic links from the application using Branch IO. It generates link properly but sometime theres error generating link like
The request timed out.
CFNetwork handshake failed
Is this issue from branch side?
Found error in my network. Due to firewall issue, some of the packets were dropped.
Tried from other network i was able to get rid of the above issue.

Socket.io client can't connect after first attempt

Socket.io connects to the Java Netty server. If socket.io tries to connect the server while it's down, 404 will be ocurred. So Javascript console says:
http://mylocalhost.com/socket.io/1/?t=1354790544338 - Failed to load resource
After this the socket.io connection dies completely. It won't try to connect again because of that 404...
How should I handle this? I tried to set an interval which would try to connect every five seconds, put the server online, but it won't try to connect because of that error.
After page reload it works normally. Is there a way in socket.io for observing when the server is online again and then connect to it? What could be a proper solution?
I've made sure that the socket.io.js client javscript is loaded correctly, and my understanding of what's happening is this:
socket.io starts handshakes, and socket.socket.connecting is set to true
request to http://mylocalhost.com/socket.io/1/?t=1354790544338 causes 404 because the server is down
this is an error, but socket.socket.connecting remains as true, which causes next reconnect attempts to fail, because it won't try to reconnect if it thinks that it's already trying to reconnect
I've tried calling disconnect() before trying to reconnect, and it sets reconnecting as false, but when there's no connected socket and I call disconnect(), it throws "Cannot call method 'close' of undefined".
What could be a proper solution to get that reconnecting as false, kinda "reset" socket.io to be ready for next connection attempt?
Setting handlers for all of the possible socket.io client errors seemed to fix this problem for me*. That includes:
'connect_error'
'connect_timeout'
'reconnect_error'
'reconnect_failed'
'error'
After a bit of experimenting, the 'error' handler seems to be the important one for preventing the 404 from stopping everything else.
*seemed to fix, because I can't reliably reproduce it in my local test setup. Would be good to know if adding these handlers fixes the problem for anyone else.
The socket.io file it tries to request contains actual script to use in JS. This file is served by your Java server. So when you request this file - it will fail to load, that is why you see 404 error.
Since file is not loaded, anything related to sockets that comes from that file wont be available.
So what you want to try to do, is to catch scenario when script file is not loaded. Check here: load scripts asynchronously
So you have to try to load this script asynchronously, and check on status after load. If it failed or did not responded in time - flush request handle, and request again after some delay.
Once file will be successfully loaded, you can start using JS functions to call connect and so on.

Resources