rewrite based on external conditions?

nullx8

Active Member
#1
we have 2 targets
- a php file served in the same virtual host
- a external recourse served via external app & context proxy

is it somehow possible to change the rewrite rule used based on a condition (eg a file being present or a variable)

the idea is to have the same URI to access but have the server decide which rewrite rule to aplly based on a external status.
 

nullx8

Active Member
#3
well i figured it out .. i just made a Proxy and a php file
the PHP File either serves the static image or sends a header to the live version (depending on the setting)
and for the webserver to "know" the setting i just touch a file and have mod_rewrite look for it.

problem solved ;)

rewrite is like this now (where "/c/officecam-islive" is just a empty file telling lsws to use the proxy over the static file)
this way the external url is always the same.

Code:
RewriteCond %{DOCUMENT_ROOT}/c/officecam-islive -f
RewriteRule ^/cctv/office-live\.jpg(\?.*)? http://Proxy:IPCam-Office/videostream.cgi?user=xxx&pwd=xxx [P, L]
RewriteRule ^/cctv/office-live\.jpg(\?.*)? /lib/cams/cam.office.php$1 [L]
The only "problem" left now is a way to terminate connections already established (since the proxy triggers a stream),
is there a way to "reset" the connection to the proxy from outside?
 
Top