Hello, this is my current Apache2 VHost:
It is explicitly about the first part, this one: [I have posted everything as there may be incompatibilities]
I would like that if the URL is 1:1 [!!!] like this [except the variable, which should not matter]:
What should the part look like then?
Apache config:
<VirtualHost *:80>
ServerName url.tld
DocumentRoot /var/www/html
<Location "/pihole/api.php">
<If "%{REQUEST_URI} =~ m#/pihole/api.php# && %{QUERY_STRING} =~ m#&auth=code#">
Require all granted
SetEnv CORS_HOSTS request-url.tld
</If>
</Location>
<LocationMatch "^(?!/font|/files).*">
Require all denied
ErrorDocument 403 "Error"
</LocationMatch>
Alias "/font" "/var/www/fonts"
<Directory "/var/www/fonts">
Require all granted
Header set Access-Control-Allow-Origin "*"
RewriteEngine On
RewriteCond %{QUERY_STRING} !auth=authcode
RewriteRule ^ - [F]
RewriteRule ^ - [L]
ErrorDocument 403 "Error"
</Directory>
Alias "/files" "/var/www/files"
<Directory "/var/www/files">
Require all granted
Header set Access-Control-Allow-Origin "*"
RewriteEngine On
RewriteCond %{QUERY_STRING} !auth=authcode
RewriteRule ^ - [F]
RewriteRule ^ - [L]
ErrorDocument 403 "Error"
</Directory>
</VirtualHost>
Apache config:
<Location "/pihole/api.php">
<If "%{REQUEST_URI} =~ m#/pihole/api.php# && %{QUERY_STRING} =~ m#&auth=code#">
Require all granted
SetEnv CORS_HOSTS request-url.tld
</If>
</Location>
https://url.tld/pihole/api.php?<variable>&auth=code
is "proxyed" to this specific url: http://ip:port/admin/api.php?<variable_from_requesturl>&auth=code
What should the part look like then?