Re: [users@httpd] Need help with correlating HTTP request with a database call

2023-07-04 Thread Antony Stone
On Tuesday 04 July 2023 at 18:52:10, Sudesh Gowda J wrote:

> I'm currently working on a project where Apache server is being used with a
> database. I need to find out which HTTP request maps to which database call
> without modifying the server code(eg., Logs). I read the documentation
> regarding logging and the parameters don't seem to be of any help in this
> case. So is there any other way in which we can do this

I would have thought the simplest way is to look at the code running on the 
server (no need to modify it, just read it) and work out what it does in the 
database for any given type of request.

What language is the server code written in?


Antony.

-- 
#define SIX 1+5
#define NINE 8+1

int main() {
printf("%d\n", SIX * NINE);
}
- thanks to ECB for bringing this to my attention

   Please reply to the list;
 please *don't* CC me.

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Need help with correlating HTTP request with a database call

2023-07-04 Thread Frank Gingras
httpd is not privy to the database layer of your application; you will need
to focus on isolating the correlation conditions first, i.e. the request
uri path, the date/time of the request, the HTTP method (GET, POST).

On Tue, Jul 4, 2023 at 1:52 PM Sudesh Gowda J 
wrote:

> Hello everyone,
> I'm currently working on a project where Apache server is being used with
> a database. I need to find out which HTTP request maps to which database
> call without modifying the server code(eg., Logs). I read the documentation
> regarding logging and the parameters don't seem to be of any help in this
> case. So is there any other way in which we can do this
>
> Thank you
>
>
>


[users@httpd] Need help with correlating HTTP request with a database call

2023-07-04 Thread Sudesh Gowda J
Hello everyone,
I'm currently working on a project where Apache server is being used with a
database. I need to find out which HTTP request maps to which database call
without modifying the server code(eg., Logs). I read the documentation
regarding logging and the parameters don't seem to be of any help in this
case. So is there any other way in which we can do this

Thank you


Re: [users@httpd] Apache httpd with Node.js backend server.

2023-07-04 Thread Frank Gingras
This isn't how ProxyPassReverse is to be used, see:

https://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypassreverse

On Tue, Jul 4, 2023 at 1:21 PM Kaushal Shriyan 
wrote:

> Hi,
>
> I have added the below ProxyPassMatch and ProxyPassReverse in
> /etc/httpd/conf.d/phpnodejs.conf after referring to
> https://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypassmatch
>
> ProxyPassMatch"/demo(.*)" "http://localhost:8000/$1
> "
> ProxyPassReverse  "/demo(.*)" "http://localhost:8000/$1
> "
>
> *#cat /etc/httpd/conf.d/phpnodejs.conf*
> 
> ServerName phpnodejs.mydomain.com
> Redirect / https://phpnodejs.mydomain.com/
>  
> 
> DocumentRoot /var/www/html/phpcode/cardium-version-1/web
> DirectoryIndex index.php
> ServerName phpnodejs.mydomain.com
> Header add Access-Control-Allow-Origin "*"
> SSLEngine on
> SSLCertificateFile /etc/letsencrypt/live/
> phpnodejs.mydomain.com/cert.pem
> SSLCertificateKeyFile /etc/letsencrypt/live/
> phpnodejs.mydomain.com/privkey.pem
> SSLCertificateChainFile /etc/letsencrypt/live/
> phpnodejs.mydomain.com/chain.pem
> Header always set Strict-Transport-Security "max-age=63072000;
> includeSubDomains"
> ProxyPass /index.php !
> ProxyPassMatch"/demo(.*)" "http://localhost:8000/$1
> "
> ProxyPassReverse  "/demo(.*)" "http://localhost:8000/$1
> "
>
> 
> DirectoryIndex index.html index.php
> Options FollowSymLinks
> AllowOverride All
> Require valid-user
> AuthType Basic
> AuthName "Restricted Content"
> AuthUserFile /var/www/html/phpcode/cardium-version-1/web/.htpasswd
> 
> 
>
> When I hit https://phpnodejs.mydomain.com the html and php code it works
> perfectly along with loading the resources like js, css and html pages.
> Whereas when I hit https://phpnodejs.mydomain.com/demo (/demo) which is
> the node.js backend listening on port 8000, I see the below logs in
> /var/log/httpd/ssl_access_log
>
> /demo is the node.js backend service listening on port 8000.
>
> 172.16.16.45 - - [04/Jul/2023:22:35:05 +0530] "GET
> /demo/element/index.html HTTP/1.1" 304 -
> 172.16.16.45 - - [04/Jul/2023:22:35:05 +0530] "GET /demo/element/vendor.js
> HTTP/1.1" 304 -
> 172.16.16.45 - - [04/Jul/2023:22:35:05 +0530] "GET
> /demo/element/demo/apic-build.js HTTP/1.1" 304 -
> 172.16.16.45 - drupaladmin [04/Jul/2023:22:35:05 +0530] "GET
> /__es-dev-server__/message-channel HTTP/1.1" 404 25657
>
> More details here -> http://sprunge.us/6DFmPx
>
> # apachectl -S
> VirtualHost configuration:
> *:443  phpnodejs.mydomain.com
> (/etc/httpd/conf.d/phpnodejs.conf:5)
> *:80   is a NameVirtualHost
>  default server phpnodejs.mydomain.com
> (/etc/httpd/conf.d/phpnodejs.conf:1)
>  port 80 namevhost phpnodejs.mydomain.com
> (/etc/httpd/conf.d/phpnodejs.conf:1)
>  port 80 namevhost phpnodejs.mydomain.com
> (/etc/httpd/conf.d/phpnodejs.conf:1)
> ServerRoot: "/etc/httpd"
> Main DocumentRoot: "/var/www/html"
> Main ErrorLog: "/etc/httpd/logs/ssl_error_log"
> Mutex authdigest-opaque: using_defaults
> Mutex watchdog-callback: using_defaults
> Mutex proxy-balancer-shm: using_defaults
> Mutex rewrite-map: using_defaults
> Mutex ssl-stapling-refresh: using_defaults
> Mutex authdigest-client: using_defaults
> Mutex lua-ivm-shm: using_defaults
> Mutex ssl-stapling: using_defaults
> Mutex proxy: using_defaults
> Mutex authn-socache: using_defaults
> Mutex ssl-cache: using_defaults
> Mutex default: dir="/run/httpd/" mechanism=default
> Mutex mpm-accept: using_defaults
> Mutex cache-socache: using_defaults
> PidFile: "/run/httpd/httpd.pid"
> Define: DUMP_VHOSTS
> Define: DUMP_RUN_CFG
> User: name="apache" id=48
> Group: name="apache" id=48
> #
>
> Please guide me. Thanks in advance.
>
> Best Regards,
>
> Kaushal
>
> On Mon, Jul 3, 2023 at 10:54 PM Kaushal Shriyan 
> wrote:
>
>>
>>
>> On Mon, Jul 3, 2023 at 10:44 PM Richard <
>> lists-apa...@listmail.innovate.net> wrote:
>>
>>>
>>>
>>> > Date: Monday, July 03, 2023 22:22:04 +0530
>>> > From: Kaushal Shriyan 
>>> >
>>> > On Mon, Jul 3, 2023 at 10:10 PM Richard wrote:
>>> >
>>> >>
>>> >> > Date: Monday, July 03, 2023 20:35:36 +0530
>>> >> > From: Kaushal Shriyan 
>>> >> >
>>> >> > I have initiated a new thread to discuss the new issue. I am
>>> >> > running node.js application on port 8000 and Apache HTTP server
>>> >> > on CentOS Linux release 7.9.2009 (Core)
>>> >> >
>>> >> ># node --version
>>> >> > *v16.20.0*
>>> >> ># httpd -v
>>> >> > Server version: *Apache/2.4.57 (IUS)*
>>> >> > Server built:   Apr  7 2023 14:49:47
>>> >> >#
>>> >> >
>>> >> > *#cat /etc/httpd/conf.d/phpnodejs.conf*
>>> >> > 
>>> >> > ServerName phpnodejs.mydomain.com
>>> >> > Redirect / https://phpnodejs.mydomain.com/
>>> >> >  
>>> >> > 
>>> >> > DocumentRoot /var/www/html/phpcode/cardium-version-1/web

Re: [users@httpd] Apache httpd with Node.js backend server.

2023-07-04 Thread Kaushal Shriyan
Hi,

I have added the below ProxyPassMatch and ProxyPassReverse in
/etc/httpd/conf.d/phpnodejs.conf after referring to
https://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypassmatch

ProxyPassMatch"/demo(.*)" "http://localhost:8000/$1
"
ProxyPassReverse  "/demo(.*)" "http://localhost:8000/$1
"

*#cat /etc/httpd/conf.d/phpnodejs.conf*

ServerName phpnodejs.mydomain.com
Redirect / https://phpnodejs.mydomain.com/
 

DocumentRoot /var/www/html/phpcode/cardium-version-1/web
DirectoryIndex index.php
ServerName phpnodejs.mydomain.com
Header add Access-Control-Allow-Origin "*"
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/
phpnodejs.mydomain.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/
phpnodejs.mydomain.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/
phpnodejs.mydomain.com/chain.pem
Header always set Strict-Transport-Security "max-age=63072000;
includeSubDomains"
ProxyPass /index.php !
ProxyPassMatch"/demo(.*)" "http://localhost:8000/$1
"
ProxyPassReverse  "/demo(.*)" "http://localhost:8000/$1
"


DirectoryIndex index.html index.php
Options FollowSymLinks
AllowOverride All
Require valid-user
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /var/www/html/phpcode/cardium-version-1/web/.htpasswd



When I hit https://phpnodejs.mydomain.com the html and php code it works
perfectly along with loading the resources like js, css and html pages.
Whereas when I hit https://phpnodejs.mydomain.com/demo (/demo) which is the
node.js backend listening on port 8000, I see the below logs in
/var/log/httpd/ssl_access_log

/demo is the node.js backend service listening on port 8000.

172.16.16.45 - - [04/Jul/2023:22:35:05 +0530] "GET /demo/element/index.html
HTTP/1.1" 304 -
172.16.16.45 - - [04/Jul/2023:22:35:05 +0530] "GET /demo/element/vendor.js
HTTP/1.1" 304 -
172.16.16.45 - - [04/Jul/2023:22:35:05 +0530] "GET
/demo/element/demo/apic-build.js HTTP/1.1" 304 -
172.16.16.45 - drupaladmin [04/Jul/2023:22:35:05 +0530] "GET
/__es-dev-server__/message-channel HTTP/1.1" 404 25657

More details here -> http://sprunge.us/6DFmPx

# apachectl -S
VirtualHost configuration:
*:443  phpnodejs.mydomain.com
(/etc/httpd/conf.d/phpnodejs.conf:5)
*:80   is a NameVirtualHost
 default server phpnodejs.mydomain.com
(/etc/httpd/conf.d/phpnodejs.conf:1)
 port 80 namevhost phpnodejs.mydomain.com
(/etc/httpd/conf.d/phpnodejs.conf:1)
 port 80 namevhost phpnodejs.mydomain.com
(/etc/httpd/conf.d/phpnodejs.conf:1)
ServerRoot: "/etc/httpd"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/etc/httpd/logs/ssl_error_log"
Mutex authdigest-opaque: using_defaults
Mutex watchdog-callback: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex authdigest-client: using_defaults
Mutex lua-ivm-shm: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex authn-socache: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/run/httpd/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex cache-socache: using_defaults
PidFile: "/run/httpd/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="apache" id=48
Group: name="apache" id=48
#

Please guide me. Thanks in advance.

Best Regards,

Kaushal

On Mon, Jul 3, 2023 at 10:54 PM Kaushal Shriyan 
wrote:

>
>
> On Mon, Jul 3, 2023 at 10:44 PM Richard <
> lists-apa...@listmail.innovate.net> wrote:
>
>>
>>
>> > Date: Monday, July 03, 2023 22:22:04 +0530
>> > From: Kaushal Shriyan 
>> >
>> > On Mon, Jul 3, 2023 at 10:10 PM Richard wrote:
>> >
>> >>
>> >> > Date: Monday, July 03, 2023 20:35:36 +0530
>> >> > From: Kaushal Shriyan 
>> >> >
>> >> > I have initiated a new thread to discuss the new issue. I am
>> >> > running node.js application on port 8000 and Apache HTTP server
>> >> > on CentOS Linux release 7.9.2009 (Core)
>> >> >
>> >> ># node --version
>> >> > *v16.20.0*
>> >> ># httpd -v
>> >> > Server version: *Apache/2.4.57 (IUS)*
>> >> > Server built:   Apr  7 2023 14:49:47
>> >> >#
>> >> >
>> >> > *#cat /etc/httpd/conf.d/phpnodejs.conf*
>> >> > 
>> >> > ServerName phpnodejs.mydomain.com
>> >> > Redirect / https://phpnodejs.mydomain.com/
>> >> >  
>> >> > 
>> >> > DocumentRoot /var/www/html/phpcode/cardium-version-1/web
>> >> > DirectoryIndex index.php
>> >> > ServerName phpnodejs.mydomain.com
>> >> > Header add Access-Control-Allow-Origin "*"
>> >> > SSLEngine on
>> >> > SSLCertificateFile /etc/letsencrypt/live/
>> >> > phpnodejs.mydomain.com/cert.pem
>> >> > SSLCertificateKeyFile /etc/letsencrypt/live/
>> >> > phpnodejs.mydomain.com/privkey.pem
>> >> > SSLCertificateChainFile 

Re: [users@httpd] reverse proxying websocket connections

2023-07-04 Thread Helmut K. C. Tessarek

On 2023-07-04 03:58, Yann Ylavic wrote:

Yes, they should be the same. Upgrade only takes place when requested
AND accepted/switched by the backend server.


Awesome. Thanks so much for the confirmation.

Have a great day,
  K. C.

--
regards Helmut K. C. Tessarek  KeyID 0x172380A011EF4944
Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944

/*
   Thou shalt not follow the NULL pointer for chaos and madness
   await thee at its end.
*/



signature.asc
Description: OpenPGP digital signature


Re: [users@httpd] reverse proxying websocket connections

2023-07-04 Thread Yann Ylavic
On Tue, Jul 4, 2023 at 2:28 AM Helmut K. C. Tessarek
 wrote:
>
> The documentation states:
>
> Proxying both HTTP and websockets at the same time, where the websockets URL's
> are not websocket-only or not known in advance can be done by using the
> RewriteRule directive to configure the websockets proxying:
>
> ProxyPass / http://example.com:9080/
> RewriteEngine on
> RewriteCond %{HTTP:Upgrade} websocket [NC]
> RewriteCond %{HTTP:Connection} upgrade [NC]
> RewriteRule ^/?(.*) "ws://example.com:9080/$1" [P,L]
>
> However, I was wondering, whether the following is an equivalent directive
> (just in a single line ;-)):
>
> ProxyPass / http://example.com:9080/ upgrade=websocket
>
> afaik the upgrade only takes place when it is requested by a header, unless
> upgrade=NONE or upgrade=ANY is set.
>
> Am I correct or are the not the same?

Yes, they should be the same. Upgrade only takes place when requested
AND accepted/switched by the backend server.


Regards;
Yann.

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org