CGI webapp with 504 Error

Hi, I have a webapp running on a root server over cgi. Works good.

But since some days I get a lot of 504 errors, displayed in the console.

This is, whats written:

[quote]POST https://domain.de/via_app/via_17.cgi/F89860D11150CBBC6B7E0D80378C16C357319F90/comm/push 504 ()
begin @ framework.js:411
[/quote]

How can I fix this?

This is what the proxy_error_log says:

2017/03/20 13:16:14 [error] 21818#0: *141602 upstream timed out (110: Connection timed out) while reading response header from upstream, client: [IP], server: domain.de, request: "POST /via_app/via_17.cgi/F89860D11150CBBC6B7E0D80378C16C357319F90/comm/push HTTP/2.0", upstream: "https://[IP]:7081/via_app/via_17.cgi/F89860D11150CBBC6B7E0D80378C16C357319F90/comm/push", host: "vms.via-cloud.de", referrer: "https://domain.de/via_app/via_17.cgi"

No one an idea? :confused:

I get now another error too:

POST https://vms.via-cloud.de/via_app/via_17.cgi/E84E3B08299DF08F3494743531AF963173819621/comm/event/EVli9YOB.scrolled 500 () triggerEvent @ framework.js:281 container.onScroll @ framework.js:6411 framework.js:2107 HTTP Error:

I occurs not on every action, but it often occurs when the server has to send some actions or data back to client.

Did you recently build it with a different version of Xojo? A month ago I updated our web app and used a different version than before and I too had lots of errors, my service was down for 4 hours. Until I dug out an older version of Xojo that worked for me.

[quote=321727:@Lars Lehmann]No one an idea? :confused:

I get now another error too:

POST https://vms.via-cloud.de/via_app/via_17.cgi/E84E3B08299DF08F3494743531AF963173819621/comm/event/EVli9YOB.scrolled 500 () triggerEvent @ framework.js:281 container.onScroll @ framework.js:6411 framework.js:2107 HTTP Error:

I occurs not on every action, but it often occurs when the server has to send some actions or data back to client.[/quote]
Unfortunately what you’ve provided is close to nothing. The framework is compiled differently for every app depending on what controls are used and in what order they are encountered when compiling. Saying line 6411 or 281 is worthless without at least having access to the online app.

That said, a 5xx error is a server error and the most frequent answer in these situations is that the app is crashing. Do you have the UnhandledException events implemented and outputting the stack to a file?

Yes, I have implement the UnhandledException @Greg O’Lone . there are no app side errors which can be handled :confused:

There’s no scheme when the error occurs, It seems randomly.

I’ll try to use an older Xojo version.

And I’ll setup a test app to give you access.

[quote=321825:@Lars Lehmann]Yes, I have implement the UnhandledException @Greg O’Lone . there are no app side errors which can be handled :confused:

There’s no scheme when the error occurs, It seems randomly.

I’ll try to use an older Xojo version.

And I’ll setup a test app to give you access.[/quote]
Have you looked at the server logs to see if the app is encountering a hard crash?

The app is still working, its not crashing. Only some action does not affect.

In the proxy-error-log I got this messages:

2017/03/21 14:59:53 [error] 630#0: *54 upstream timed out (110: Connection timed out) while reading response header from upstream, client: {IP}, 
server: {Domain}, request: "POST /via_app/via_17.cgi/A6E7E17DC6399B9AB443F2F60D389B866BA0812B/comm/push HTTP/2.0", upstream: "https://{IP}:7081/via_app/via_17.cgi/A6E7E17DC6399B9AB443F2F60D389B866BA0812B/comm/push", host: "{Domain}", 
referrer: "https://{Domain}/via_app/via_17.cgi"

How is your proxy setup? It almost looks like a proxy configuration problem, but it’s not clear to me how things are running. Not sure why you would proxy to a cgi. Maybe you could describe your setup a bit.

Also, I haven’t checked myself, but is it normal to see requests as HTTP 2.0 to a xojo cgi app? I was thinking it didn’t support 2.0, but maybe that only applies to stand alone apps.

They could be for cgi. It’s the web server or reverse proxy that’s handling that part.

My Setup:
I have a root server with plesk. I’ve got Apache running and Nginx. Nginx delivers all to Apache. I’ve got no special options there.

In the apache2.conf I activated CGI using this:

ScriptAlias /cgi-bin/ /var/www/vhosts/{the/folders}/via_app/
<Directory "/var/www/vhosts/{the/folders}/via_app/">
  AllowOverride All
  Options +ExecCGI
  Options FollowSymLinks MultiViews
  Require all granted
</Directory>

Why does only sometimes some action fail in an 504 error, and not everyone? The app itself is still running. And there is no problem running the app locally.

This wouldn’t be a problem for me, if I could bring the reverse proxy to live :slight_smile:
see here

If you can use a proxy, then I personally would recommend just going to haproxy and make that work. For public facing apps I only run stand alone behind haproxy. I’ve got a few things out there running and I can’t recall any issues I’ve had running things that way.

For the apps I have running as cgi, they seem to have issues now and then. I have started using htaccess files to password protect them at the apache level to keep bots or search engines or who knows what from randomly hitting them and making them lock up. These apps are low usage internal, but are accessible for us from the internet.

So for me, I’ve had good success with haproxy -> stand alone app. You can put haproxy in front of almost anything, so if you need apache and/or nginx too, then you can also put them behind haproxy.

There’s also a new plugin apparently (which I haven’t tried yet) to allow haproxy to pull Let’s Encrypt ssl certificates for your sites without having to take anything offline during the verification process. I plan on setting that up on one of my sites when the current ssl cert is close to expiration.

So,

I solved the reverse-proxy problem, with running the app on an own subdomain:
http://vms2.via-cloud.de/

But!

Now the same problem with the 504-Error (gateway timeout) occurs!

Strange.

I thought this is dedicated CGI problem.

Please help me, what can I do? :confused: :frowning:

That error is not specific enough as we don’t know the reason for the timeout. Could be the config issue from the other thread. Might want to link that thread in here and just stick to one, or start over with the current status and configuration. I’d really like to help you get this working, but it’s become quite scattered.

Okay, I solved it using a reverse proxy with a standalone app.

Thank y’all for helping me!!!