When asking regex questions, always add the tag for the specific programming language or tool (e.g., Perl, Python, or Java; vi, emacs, or ɢɴᴜ grep; etc.) you are using.

learn more… | top users | synonyms (1)

0
votes
0answers
13 views

Fail2ban on CentOS, dovecot filters regex not matching logs

I'm starring at this regex for some time now and it seems perfectly matching lines from my log files but I can't get it to work, not even with modifications. I suspect the problem might be with the ...
0
votes
1answer
18 views

Using RewriteRule to match RewriteMap value and ignore any trailing slash and characters?

I'm trying to use RewriteMap in a apache 2.4 virtualhost .conf file to redirect a number of URLs. A variety of requests can refer to a single entry in the map and I'm having trouble matching these ...
0
votes
0answers
22 views

fail2ban: regex to block \x00 requests?

Every once in a while my server goes down, and when I check my nginx logs, I usually see something like this: 78.37.54.31 - - [20/Apr/2016:20:58:51 +0300] ...
0
votes
1answer
25 views

Simple nginx server_name regex does not find match

I have an nginx box running version 1.8.1 on AWS. I am converting numerous DNS routing conditions into nginx and have encountered many DNS entries where *.yet_another_domain.* would be useful, but ...
0
votes
0answers
6 views

Odd regex behaviour matching newlines with s and m modifiers

I wish to remove a block of code from a file - along with any unnecessary newlines. Input file 'test' <block 1> nothing here </block> <block 2> foo bar </block> <block ...
1
vote
0answers
17 views

nginx and site.erb: tag as internal users for two different domains and two different sets of IPs

I have an nginx server and a site.erb file and two different domains (domain1 and domain2). Currently a tag (for Google Tag Manager) will be set when someone visits the sites from a particular set of ...
0
votes
0answers
20 views

NGINX not recognizing $request

Well.. NGINX or me guess.. something that I'm not doing OK. The point is, I'm getting some request from bots of this type: 91.123.1.56 - - [04/Apr/2016:12:13:39 +0200] ...
0
votes
0answers
35 views

fail2ban regex correctly write

Sorry for my bad english. Server nginx. Block /administrator/ http_access_module nginx-error.log [error] 10934#0: *11435 access forbidden by rule, client: 213.87.x.x, server: localhost, request: ...
0
votes
1answer
18 views

Postfix header_checks and unicode regexp

Does postfix support unicode regular expressions like \p{Han} to detect unicode scripts? I would like to use them with header_checks.
1
vote
1answer
23 views

Rewrite bad url extention to .html in NGINX

A while back I made a mistake writing my urls and Google has them cached in old sitemaps. This is creating a ton of 404 errors in WMT that I need to clean up with a solid rewrite. I currently use the ...
0
votes
2answers
36 views

Serving images from two different directories with Nginx

This should be basic... I'm brand new, and no amount of googling and searching stack exchange is helping. I have a website that I want to be able to serve images from, from different directories. I ...
2
votes
1answer
93 views

mod_rewrite with multiple QUERY STRINGS

This is an extension to my question http://serverfault.com/a/761474/77231 I am trying to add an additional QUERY STRING parameter to the URL and change spaces to underscores but am having no success. ...
0
votes
0answers
37 views

Regex nginx location with named location

I have the following set up - a production version of some software; location @myradio { rewrite ^/myradio/([^/]+)/([^/]+)/? /myradio/index.php?module=$1&action=$2 last; rewrite ...
1
vote
1answer
22 views

Nginx rewrite to remove .php from files has no effect but to redirect to homepage

I'm trying to make a rewrite to remove .php from my URLs but so far no luck. Here's what I've got so far and then my results with this config below. location ~ \.php$ { try_files $uri/ ...
1
vote
1answer
42 views

Exchange 2013 RegEx transport rule

I am looking to create some transport rules for outgoing email based upon AD properties. eg. Phone: 123-456-7890 Where the actual inserted code looks like "Phone: %%PhoneNumber%%", retrieving the ...
-1
votes
1answer
37 views

Nginx redirect 2 level subpaths

I have the following redirect rule: rewrite ^/path1/(.+)$ /path1/index.php?/$1 last; rewrite ^/path2/(.+)$ /path2/index.php?/$1 last; rewrite ^/path3/(.+)$ ...
0
votes
1answer
31 views

.htaccess config not working properly

Here is my current situation: Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d [NC] RewriteCond %{REQUEST_FILENAME} !-f [NC] #the rule RewriteRule ...
0
votes
1answer
14 views

Implement apache equivalent mod_rewrite functionality in lighttpd

Here's the mod_rewrite .htaccess file which is meant to work on Apache Servers for my web-app RewriteEngine On RewriteBase /cs200/tokens/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond ...
0
votes
1answer
302 views

Block specific URL in HAProxy / url-encoding

I'm trying to restrict access to a specific URL. It should not allowed to access /admin.php. frontend example acl restricted_page path_beg -i /admin\.php http-request deny if restricted_page ...
0
votes
1answer
25 views

Insert a variable route path into nginx location configuration

I have a simple user based storage for images where I have a main folder say 'users' and within it, my server creates variable folders to store images for each user. The string used for the folder is ...
0
votes
1answer
148 views

match special characters in url in nginx

I ran dotdotpwn to test transversal attacks on a web server using nginx/nasxi/doxsi and the only "successes" were urls that started with a question mark. No big deal since they just defaulted to the ...
0
votes
0answers
20 views

Regex in Exchange transport rule

We are receiving external emails with invalid characters in the emails address which is causing issues for applications linked to the mailboxes. The receipient addresses contain single quotes ...
0
votes
1answer
83 views

url rewrite, nginx throw 404 errors, nothing in error logs

below rewrite works fine: rewrite ^/city/restaurants$ /city/listings/restaurants permanent; but this doesnt work rewrite ^/city/restaurants$ /city/listings/restaurants last; rewrite ...
1
vote
0answers
16 views

URL rewrite is producing 404

I'm trying to rewrite office.domain.com/app1 requests to server3:81 using the rule below, but I'm getting a 404. I can browse to server3:81 just fine. The Failed Request Tracing logs are available ...
0
votes
0answers
38 views

Redirect lang set in url with Nginx regex

I can't find the way to redirect the lang set in url with Nginx. I tried this: location ~ ^/(en|fr|de)/cloud/signup { return 301 $scheme://cloud.$host/$1/home/new; } Also this: location ...
1
vote
2answers
62 views

Exim: match recipient address against certain regex and conditional email delivery

I need to allow my customers to use e-mails in format of 4ca2bc00-6789-4161-bae7-c11c5b91454e@example.com, where the username part is sort of UUID. Those emails should be delivered to certain (single) ...
3
votes
0answers
42 views

Regex location block not working in NGINX

I have a pretty simple location block in my nginx conf that looks like this: location ~* ^\/[a-z0-9]{24}$ { // do some things } I'm attempting to catch urls that end in a Mongo ObjectId. eg: ...
0
votes
0answers
12 views

Apache ProxyPass rules to stop at first match [duplicate]

I want to stop ProxyPass rules to stop executing at first match. I've given some rewrite rules in the end. So Rewriterules are getting executed all the time. Below is the two lines, i want to work ...
1
vote
1answer
99 views

Fail2Ban regex to match these lines?

I've been trying to get fail2ban to work with the Xeams email spam filter. But, I can't figure out what possible regex I should use to match the logs. The logs are in this format. 61.240.144.65 ...
3
votes
2answers
65 views

ubuntu 14.04 Apache 2.4.7 mpm_event Files and FilesMatch not working

We recently switched our Apache 2.4.7 mode from mpm_pre-fork to mpm_event. Since then we haven't been able to get our Files directive to work. <Files "*.php"> Header set Cache-Control ...
1
vote
1answer
90 views

Is fail2ban not matching these lines just because of the port?

I would like fail2ban to engage against these lines and block the example IP address included: [Tue Dec 08 12:17:13.622175 2015] [:error] [pid 30390] [client 62.210.88.201:38139] script ...
0
votes
0answers
17 views

Nginx: redirect from some-site-username.server to some.site.username.server

Can you help me pls: need configure Nginx that he made next: when we go to some-site-username.server he redirect us to some.site.username.server Main problem - on the server many users, so I can't ...
1
vote
0answers
40 views

How do I set Host Groups on Fail2ban for Wordpress?

I'm trying to set up a custom filter for fail2ban on a wordpress site. I've been following this tutorial but when I try to test my custom filter, I get the error: server.failregex.RegexException: No ...
0
votes
2answers
41 views

.htaccess rule to 301 redirect /?my_foo=bar to /foo/bar/

I tried, unsuccessfully, for hours to build (what I think is) a simple 301 redirect in an htaccess file. My url looks like this: www.example.com/?my_foo=bar And I want it to 301 redirect to: ...
0
votes
2answers
115 views

Prepend String using perl/awk/sed?

I'm trying to script a change to my apache config file (httpd.conf). I'm trying to match the following string: # # DirectoryIndex: sets the file that Apache will serve if a directory And PREPEND ...
1
vote
1answer
121 views

Nginx Config Location Regex With Language Code In Url

Trying to achieve constant language code in url's 1st segment with nginx regex location configuration and could not find the correct syntax. Necessary result: example.com stays example.com ...
1
vote
1answer
55 views

How to parse s3 logs?

I've been trying to parse AWS S3 logs following the documentation, but I've been running into some problems. Specifically, I keep running into new, rare log lines that break my regex. Every time this ...
1
vote
0answers
51 views

How to modify the message string being logged by syslog?

I have a few linux systems with the keyboard and console shared via a KVM switch. When I switch between them, I get a lot of unwanted syslog messages regarding the keyboard connecting and ...
1
vote
1answer
39 views

Redirect page to 410 if match a specific Regex in .htacces

First time using .htaccess so I come here to have a bit of help since the web is not that file with informations (or I just don't find them :/). So the idea is that I want to redirect link ending by ...
1
vote
1answer
531 views

Apache HTTP LocationMatch Redirect using Negative RegEx

I'm trying to create a Redirect using Apache HTTP Server's mod_alias and core on my system: # cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.1 (Maipo) # rpm -q httpd ...
0
votes
0answers
69 views

Rewrite /a/1/2 to /a.php using Nginx

I'm taking over a really old app and migrating it from apache to nginx. What I currently have. This works: # catch specific paths, rewrite to first segment # /a/1/2 => a.php # /b/3/4 => b.php ...
0
votes
1answer
39 views

Unable to use grep regex to search for filename containing period

Ubuntu 14.x. Using grep to search for all files linuxtest-client2. This includes multiple file extensions (csr, crt, key). When I grep for the middle portion of the filename, "2.", it also returns ...
1
vote
0answers
26 views

nginx, redirect to remove a part of filename

I know there are plenty of questions how to replace part of URL with something else (or nothing) in nginx but I really suck in regular expressions and am absolute noob in nginx. So could anybody ...
0
votes
1answer
117 views

Determining e-mail server blacklisting from log files

I have my self-hosted e-mail server. There is no current problem of being blacklisted but I want to be proactive about it and I want to start with the log files. There have been some entries in my ...
2
votes
1answer
639 views

Reg Exp for URL in HAProxy

I'm trying to build a reg exp for haproxy that will match the second URL and direct it to a different acl than the first: mysite.com/path/ mysite.com/path/something_random The issue is that my ...
1
vote
1answer
36 views

rabbitmqctl set_policy drops caret (^) anchor from regex pattern

I am running this from PowerShell, so I'm not sure if this would happen in a different environment (the regex itself just includes everything except for those starting with 'amq.'). When I run the ...
0
votes
1answer
100 views

Nginx regex to get uri minus location

I have Nginx running as a reverse proxy to a couple applications. One location directive is running correctly, sending requests to a unix socket file and onwards to its upstream wsgi app. The ...
0
votes
1answer
137 views

Fail2ban: regex test succeed but fail2ban does not ban any IP

I can't ban any ip, thought when I test my regex, it has +2000matches: > fail2ban-regex '/var/log/nginx/access.log' '/etc/fail2ban/filter.d/bad-request.conf' Date template hits: |- [# of hits] ...
0
votes
0answers
11 views

Redirection regex rule not working for ? character

I know this is probably basic but what am I missing here? I want all urls from an old domain to 301 to the homepage of the new site. So: old.com/some/thing old.com/file.php ...
0
votes
1answer
26 views

nginx regex rewrite rule for images

I have the following URLs: www.example.com/data/images/13122013-002_IM1621.jpg www.example.com/data/images/13122013-002_IM1622.jpg www.example.com/data/images/13122013-002_IM1622.jpg On the file ...