Questions tagged [setenvif]

The mod_setenvif module allows you to set internal environment variables according to whether different aspects of the request match regular expressions you specify. These environment variables can be used by other parts of the server to make decisions about actions to be taken, as well as becoming available to CGI scripts and SSI pages.

The mod_setenvif module allows you to set internal environment variables according to whether different aspects of the request match regular expressions you specify. These environment variables can be used by other parts of the server to make decisions about actions to be taken, as well as becoming available to CGI scripts and SSI pages.

29 questions
0
votes
0 answers

SetEnvIfNoCase doesn't work when user ip is IPv6

i blocked some bots in my htaccess file SetEnvIfNoCase User-Agent "sitechecker.pro" bad_bot SetEnvIfNoCase User-Agent "seostar" bad_bot SetEnvIfNoCase User-Agent "SiteCheckerBotCrawler" bad_bot SetEnvIfNoCase User-Agent "scan.lol" bad_bot
Joukhar
  • 724
  • 1
  • 3
  • 18
0
votes
0 answers

How do I edit a response header in Apache HTTP Server before it is returned to the client?

I have an Apache Server that acts both as a proxy and as a reverse proxy for various BE services. One of these services - to which I do not have access - returns a response with a Location Header that I would like to change. I can easily log this…
0
votes
0 answers

Don't apply rules if redirect happened before

I'd like to stop Apache from applying rules if the user has been redirected before: Example: Redirect 301 /foo/bar.php https://example.org/foo/bar ## Don't apply this if the user has been redirected using the 301 above RewriteCond…
SPQRInc
  • 162
  • 4
  • 23
  • 64
0
votes
1 answer

Disable htaccess auth for rewritten path

I have the following .htaccess file with basic auth and URL rewriting. I need to disable basic auth for a specific path (e.g., '/openaccess'), yet the rewriting happens first, so I can't disable the auth with SetEnvIf. The closest thing I've found…
rednoyz
  • 1,318
  • 10
  • 24
0
votes
1 answer

Apache `SetEnvIf` and duplicated headers

We are using this kind of configuration to grant access to one of our sites Order deny,allow Deny from all Allow from 127.0.0.0/8 SetEnvIf X-Forwarded-For "(,| |^)192\.168\." WhiteIP …
mveroone
  • 128
  • 7
0
votes
0 answers

Apache 2.4 how to exclude certain GET requests from log using SetEnvIf

Spent some time with docs and Google but did not find any real example for that. I want to exclude from logging many unnecessary lines like that 83.266.84.27 - - [27/Oct/2018:14:07:19 -0500] "GET example.com/mod/maxtop.php HTTP/1.1" 200 3412…
Serge
  • 679
  • 1
  • 9
  • 23
0
votes
0 answers

Multiple user agent strings in 1 htaccess file

I want to include multiple agent strings in 1 htaccess (or multiple if that is needed a.k.a each file for new agent string) file and I am not sure if that is possible This is my current code SetEnvIfNoCase User-Agent "PRIVATESTRING"…
Coco X
  • 1
  • 2
0
votes
1 answer

Apache basic auth with SetEnvIf bug

I have a problem with apache 2.4 .htaccess configuration. My config example: SetEnvIf Request_URI ^(?i).*/admin(/.*)?$ require_auth=true AuthType Basic AuthName "Secure area" AuthUserFile /xxx/.admin_htpasswd Order Deny,Allow Deny from all …
Unibit
  • 9
  • 5
0
votes
1 answer

Apache 2.2 Allow from env=_variable_

I have an Apache 2.2 set up with LDAP Authorization, which is working fantastically as expected, and have also made it so that I can bypass Authentication when accessing it locally. Allow from localIP hostnameA hostnameB, etc... If I curl from the…
Guy Park
  • 959
  • 12
  • 25
0
votes
0 answers

setEnvIf and RewriteCond doesn't catch it

I'm setting this in my vhost in Apache 2.4 SetEnvIf X-Forwarded-Proto https HTTPS=on And in my .htaccess I add this rule : RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L] but I get an infinit loop since…
colas
  • 191
  • 7
0
votes
1 answer

How do I disable GZip with SetEnvIfNoCase in Apache .htaccess?

I want to disable GZip for certain pages. I have this in my .htaccess, but it still turns GZip on (Content-Encoding: gzip) when visiting dashboard/index. AddOutputFilterByType DEFLATE text/text text/html text/plain…
Chloe
  • 25,162
  • 40
  • 190
  • 357
0
votes
1 answer

Apache's SetEnvIf to another variable in .htaccess

Is it possible using SetEnvIf to set a variable to the content of another variable? and if so, how? For example SetEnvIf defined_http_conf_var ^(.*)$ has_been_defined=%{defined_http_conf_var} So the idea is, if inside the apache.conf or httpd conf…
owenmelbz
  • 6,180
  • 16
  • 63
  • 113
0
votes
0 answers

Block website for all user agents expect one and allow all user agents to specific URL

I want to block all user agents except one for entire website, and at the same time allow access all user agents to one specific URL. When any user want to reset password I need to unblock all user agents to URL like this:…
Megadevice
  • 23
  • 1
  • 8
-1
votes
1 answer

htaccess multiple headers returning CORS mismatch

I've followed https://developer.mozilla.org/en-US/docs/Learn/Server-side/Apache_Configuration_htaccess#cross-origin_images and these stackoverflow answers Access-Control-Allow-Origin Multiple Origin Domains? To try and get this to work nicely. But…
designtocode
  • 2,215
  • 4
  • 21
  • 35
1
2