Score:0

Apache websocket and web app in the same directory structure

de flag

I have a web app running in LAMP server now I want to have some features transferred to web socket without changing the directory structure which means the root directory of the web app should be secure HTTP and the "websock" directory under the root to be a web socket application directory.

I have my web pages are working but besides I want websock directory also work

/home/webuser/www/html/app.mydomain.com -> https://app.mydomain.com/index.html (and many other web files)

along this one

/home/webuser/www/html/app.mydomain.com/websocket -> https://app.mydomain.com/websocket/index.php

Unfortunately I am getting 503 error when I point browser to https://app.mydomain.com/websocket/index.php I got

Service Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

Additionally, a 503 Service Unavailable error was encountered while trying to use an ErrorDocument to handle the request.
Apache Server at app.mydomain.com Port 443

however if I run the same code with php client instead of Apache2 server the testing code runs smoothly

My VirtualHost is like that

<Virtualhost 192.168.1.19:443>
    ServerName app.mydomain.com

    SSLEngine on
    SSLProxyEngine On
    ProxyRequests Off

    SSLCertificateFile /etc/ssl/private/app_mydomain.com/app_mydomain_com.crt
    SSLCertificateKeyFile /etc/ssl/private/app_mydomain.com/app_mydomain_com.key
    SSLCertificateChainFile /etc/ssl/private/app_mydomain.com/app_mydomain_com.ca-bundle

    DocumentRoot /home/webuser/www/html/app.mydomain.com

    ErrorDocument 503 /503.html
    ProxyPass /503.html !

    ProxyPass /websock http://localhost:3333/
    ProxyPassReverse /websock http://localhost:3333/

    RewriteEngine on
    RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
    RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
    RewriteRule .* ws://localhost:3333%{REQUEST_URI} [P]
</Virtualhost>

My loaded Apache modules are

core_module (static)
so_module (static)
watchdog_module (static)
http_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
unixd_module (static)
access_compat_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgi_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
filter_module (shared)
headers_module (shared)
mime_module (shared)
mpm_prefork_module (shared)
negotiation_module (shared)
php7_module (shared)
proxy_module (shared)
proxy_fcgi_module (shared)
proxy_http_module (shared)
proxy_wstunnel_module (shared)
reqtimeout_module (shared)
rewrite_module (shared)
setenvif_module (shared)
socache_shmcb_module (shared)
ssl_module (shared)
status_module (shared)

For some reasons I could not run a seperate php cli. I have to use Apache. Any help would be appreciated about correction of my virtualhost

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.