reverse proxy: HTTP 400 483 with Apache ProxyPassMatch and RewriteCond

I keep getting an error from:

apache_1_da0b6d97082f | 172.24.0.1 - - (16/Sep/2019:15:58:52 +0000) "GET /logi HTTP/1.1" 400 483 "-" "curl/7.64.0"

But I have no idea why. It seems that the request is not passed to the php-fpm socket.

ServerName mainapp.local


    ServerName mainapp.local

    DocumentRoot /var/www/html/public/
    CustomLog /dev/stdout combined
    LogLevel debug

    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php (L,QSA)

    ProxyPreserveHost On
    ProxyPassMatch "^/(.*.php(/.*)?)$"           "unix:/run/php-main/php7.2-fpm.sock|fcgi://localhost/var/www/html/public"

    
        Options +Indexes +FollowSymLinks +IncludesNOEXEC -MultiViews
        AllowOverride All
        Require all granted
        DirectoryIndex index.php
    


It works correctly (HTTP 200) without the Rewrite directives, but obviously I need this functionality.


If i enable LogLevel debug rewrite:trace3:

apache_1_da0b6d97082f | (Mon Sep 16 16:09:31.609124 2019) (rewrite:trace2) (pid 9:tid 139661951342336) mod_rewrite.c(483): (client 172.24.0.1:48962) 172.24.0.1 - - (localhost/sid#7f059d2ad5e8)(rid#7f059c0c00a0/initial) init rewrite engine with requested uri /test
apache_1_da0b6d97082f | (Mon Sep 16 16:09:31.609148 2019) (rewrite:trace3) (pid 9:tid 139661951342336) mod_rewrite.c(483): (client 172.24.0.1:48962) 172.24.0.1 - - (localhost/sid#7f059d2ad5e8)(rid#7f059c0c00a0/initial) applying pattern '^(.*)$' to uri '/test'
apache_1_da0b6d97082f | (Mon Sep 16 16:09:31.609166 2019) (rewrite:trace2) (pid 9:tid 139661951342336) mod_rewrite.c(483): (client 172.24.0.1:48962) 172.24.0.1 - - (localhost/sid#7f059d2ad5e8)(rid#7f059c0c00a0/initial) rewrite '/test' -> 'index.php'
apache_1_da0b6d97082f | (Mon Sep 16 16:09:31.609173 2019) (rewrite:trace2) (pid 9:tid 139661951342336) mod_rewrite.c(483): (client 172.24.0.1:48962) 172.24.0.1 - - (localhost/sid#7f059d2ad5e8)(rid#7f059c0c00a0/initial) local path result: index.php

How do I create a RewriteCond for when the query string contains "*" or "?"

If the query string contains "star symbol" or ? so I need to redirect to another page, how to verify under the following condition that the query string contains "star symbol" or ?.

RewriteCond %{QUERY_STRING} q={star symbol,?}

mod rewrite – RewriteCond & RewriteRule to correctly redirect and undo the state of 301 in the .htaccess file

I have an Android application that loads a script http://example.com/apps-support/ads/ads.php?appName=my_app (my_app it could change). My hosting provider made some changes to the server a few days ago and the previous script started to return 301 Permanently Moved state. Now, when I request my script, it comes back. 301 Permanently Moved state and then redirects to the root (https://example.com?appName=my_app). Why is the redirection happening?
State 301
redirect to the root
The logic in the Android application intercepts this redirection and tries to open this URL (previously, it works correctly because there were no redirects). The situation is aggravated by the fact that I do not have the ability to update the application to solve this problem (that is, change http to https). My provider also can not solve this problem for any reason. So, in my opinion, the only solution is to modify. .htaccess case file. Therefore, I want the server to redirect my request to https and at the same time return (cancel) the state 200, As shown below:
Adequate redirection
It's possible?

My .htaccess file located at the root:

Options + FollowSymLinks
RewriteEngine On

RewriteCond% {QUERY_STRING} ^ appName = (. *) $
RewriteRule ^ http: //example.com/apps-support/ads/ads.php$ https://example.com/apps-support/ads/ads.php?%{QUERY_STRING} [R=301,L]

Unfortunately, it does not work. Any help would be appreciated.

.htaccess – Explanation of the new line in the htaccess file: RewriteCond% {REQUEST_URI}! ^ / . known / pki-validation / (?: Ballot169)?

I recently noticed that a new line was added to the htaccess file in several locations throughout the file.

RewriteCond% {REQUEST_URI}! ^ / . Known / pki-validation / (?:  Ballot169)?

I do not understand what you are doing, and I would like clarification if it is possible for your purpose.

An example of how it appears is shown in this example below.

# START WordPress

RewriteEngine On
RewriteBase /
RewriteCond% {REQUEST_URI}! ^ / . Acquaintance / acme-challenge /[0-9a-zA-Z_-]+ $
RewriteCond% {REQUEST_URI}! ^ / . Acquaintance / cpanel-dcv /[0-9a-zA-Z_-]+ $
RewriteCond% {REQUEST_URI}! ^ / . Known / pki-validation /[A-F0-9]{32} . Txt (?:  Comodo  DCV)? $
RewriteCond% {REQUEST_URI}! ^ / . Known / pki-validation / (?:  Ballot169)?
RewriteRule ^ index  .php $ - [L]
RewriteCond% {REQUEST_FILENAME}! -F
RewriteCond% {REQUEST_FILENAME}! -D
RewriteCond% {REQUEST_URI}! ^ / . Acquaintance / acme-challenge /[0-9a-zA-Z_-]+ $
RewriteCond% {REQUEST_URI}! ^ / . Acquaintance / cpanel-dcv /[0-9a-zA-Z_-]+ $
RewriteCond% {REQUEST_URI}! ^ / . Known / pki-validation /[A-F0-9]{32} . Txt (?:  Comodo  DCV)? $
RewriteCond% {REQUEST_URI}! ^ / . Known / pki-validation / (?:  Ballot169)?
RewriteRule. /index.php [L]




# END WordPress

Thanks in advance.

php – Can I verify the existence of thumbnails with RewriteCond! -f and have my driver create files that do not exist?

My team has an application written in PHP.
Most of the requests are rewritten in our index.php file using the condition below, in Apache .conf

RewriteCond% {REQUEST_FILENAME}! -F
RewriteRule ^ (. *) $ /Index.php [QSA,L]

For the thumbnails, I thought it would be a good idea to use Apache to verify these static files since it seems that they are always doing this file checking.

  1. If the thumbnail exists, then Apache will serve the thumbnail as it is assigned to the file structure.
  2. If the thumbnail does not exist, the request will simply be rewritten in index.php and routed to a controller that uses the exact same URI path. Then, you will create the thumbnail and send the image back to the same request using xsendfile.

From my tests, if the thumbnail (1) exists or is created (2), the image is cached in the browser as a normal static file and sent with the same ETAG.

All the original images for the thumbnails are on the server. / mnt.

The only problem I had was that it is difficult to change the name of the files and the structure of the file is revealed.
https://example.com// images /

If the thumbnail does not exist, then the controller will read the to find the original image to create a miniature with the

https://example.com/100x100/images/12152018/renovation/0001.png
This is a static file or a driver path.

Would this be a bad idea? Insurance? What would be the best practice?

php: is it a good idea to use Apache to verify the existence of files with RewriteCond! -F?

My team has an application written in php.
Most of the requests are rewritten in our index.php file using the condition below, in Apache .conf

RewriteCond% {REQUEST_FILENAME}! -F
RewriteRule ^ (. *) $ /Index.php [QSA,L]

For the thumbnails, I thought it would be a good idea to use Apache to verify these static files since it seems that they are always doing this file checking.

  1. If the thumbnail exists, then Apache will serve the thumbnail as it is assigned to the file structure.
  2. If the thumbnail does not exist, the request will simply be rewritten in index.php and routed to a controller that uses the exact same URI path. Then, you will create the thumbnail and send the image back to the same request using xsendfile.

From my tests, if the thumbnail (1) exists or is created (2), the image is cached in the browser as a normal static file and sent with the same ETAG.

All the original images of the thumbnails are in the server / mnt.

The only problem I had was that it is difficult to change the name of the files and the structure of the file is revealed.
https: //.com // images /

If the thumbnail does not exist, then the controller will read the to find the original image to create a miniature with the

https: //.com / 100x100 / images / 12152018 / renovation / 0001.png
This is a static file or a driver path.

Would this be a bad idea? Insurance?

What would be the best practice?