Skip to content

Commit 340fa0a

Browse files
committed
Releasing version 2016.6.0
1 parent 8adef61 commit 340fa0a

File tree

6 files changed

+154
-4
lines changed

6 files changed

+154
-4
lines changed

ChangeLog

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
* Jun 01 2016 CloudFlare Inc <help@cloudflare.com> - 2016.6.0
2+
- Set HTTPS envrionment variable for Flexible SSL reqquests
3+
4+
* May 16 2016 CloudFlare Inc <help@cloudflare.com> - 2016.5.1
5+
- Update CloudFlare IP ranges
6+
- Add EasyApache support
7+
- Update versioning scheme
8+
9+
* Jul 07 2015 CloudFlare Inc <help@cloudflare.com> - 1.3.1
10+
- Update CloudFlare IP ranges
11+
12+
* Apr 15 2014 CloudFlare Inc <help@cloudflare.com> - 1.3.0
13+
- Enable IPv6 support
14+
15+
* Mar 20 2013 CloudFlare Inc <help@cloudflare.com> - 1.2.0
16+
- Refactor for Apache 2.4, utilize autotools for RPM/DEB builds
17+
18+
* Aug 30 2012 CloudFlare Inc <help@cloudflare.com> - 1.1.2
19+
- Bugfix for intermittent segfaults under some conditions.
20+
- Pulled from remoteip codebase.

Makefile.in

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
srcdir = @srcdir@
2+
3+
DESTDIR =
4+
LIBEXECDIR = @LIBEXECDIR@
5+
6+
CPPFLAGS = @CPPFLAGS@
7+
CFLAGS = @CFLAGS@
8+
LDFLAGS = @LDFLAGS@
9+
LDLIBS = @LDLIBS@
10+
11+
APXS = @APXS@
12+
13+
all : mod_cloudflare.la
14+
15+
mod_cloudflare.la : mod_cloudflare.c
16+
$(APXS) -c $(CPPFLAGS) $(CFLAGS) $(srcdir)/mod_cloudflare.c $(LDFLAGS) $(LDLIBS)
17+
18+
$(DESTDIR)$(LIBEXECDIR) :
19+
mkdir -p $@
20+
21+
install : all $(DESTDIR)$(LIBEXECDIR)
22+
$(APXS) -i -S LIBEXECDIR=$(DESTDIR)$(LIBEXECDIR) -n 'mod_cloudflare' $(srcdir)/mod_cloudflare.la
23+
24+
clean :
25+
-rm -f $(srcdir)/.libs/*
26+
-rm -f $(srcdir)/*.o
27+
-rm -f $(srcdir)/*.lo
28+
-rm -f $(srcdir)/*.la
29+
-rm -f $(srcdir)/*.slo
30+
-rm -rf $(srcdir)/.libs
31+
-rm -rf autom4te.cache
32+
-rm -f config.log config.status
33+
34+
distclean : clean
35+
-rm -f Makefile
36+
37+
gitclean : distclean
38+
-rm -f configure src-package.tar.gz
39+
40+
src-package:
41+
@tar cz *.c configure.ac Makefile.in LICENSE ChangeLog README VERSION > $@.tar.gz
42+
43+
$(srcdir)/configure: configure.ac
44+
cd '$(srcdir)' && autoconf && ./configure
45+
46+
Makefile: Makefile.in configure

README.md

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
# mod_cloudflare for Apache #
2-
Copyright CloudFlare Inc. 2013
2+
Copyright CloudFlare Inc. 2016
33

44
## mod_cloudflare.c ##
55

66
Based on mod_remoteip.c, this Apache extension will replace the remote_ip variable in user's logs with the correct remote IP sent from CloudFlare. The module only performs the IP substitution for requests originating from CloudFlare IPs by default.
77

8-
To install, follow the instructions on:
9-
https://www.cloudflare.com/resources-downloads#mod_cloudflare
10-
8+
In addition to this, the extension will also set the HTTPS environment variable to "on" in cases where Flexible SSL is in use. This prevents software such as WordPress from being broken by Flexible SSL.
9+
10+
To install, either run apxs2 directly against the .c source file:
11+
12+
$ apxs2 -a -i -c mod_cloudflare.c
13+
14+
An alternative way to install is to use GNU autotools, which requires that autoconf and automake already be installed:
15+
16+
$ autoconf
17+
$ ./configure
18+
$ make
19+
$ make install
20+
1121
No further configuration is needed. However, if you wish to override the default values, the following directives are exposed:
1222

1323
### CloudFlareRemoteIPHeader ###
@@ -26,6 +36,10 @@ Note that on some systems, you may have to add a `LoadModule` directive manually
2636

2737
Replace `/usr/lib/apache2/modules/mod_cloudflare.so` with the path to `mod_cloudflare.so` on your system.
2838

39+
If you cannot find `apxs` or `apxs2`, install `apache2-dev` on Debian and Ubuntu, or `httpd-devel` on Red Hat and CentOS:
40+
41+
$ apt-get install apache2-dev
42+
$ yum install httpd-devel
2943

3044
NOTES:
3145

VERSION

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
MAJOR=2016
2+
MINOR=6
3+
BUILD=0

configure.ac

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
dnl Process this file with autoconf to produce a configure script.
2+
3+
AC_INIT(mod_cloudflare, m4_esyscmd([ ( VERSFILE="./VERSION"; if [ -d .git -a -x "$(which git)" -a -n "$(git describe --tags --always --dirty=-dev 2> /dev/null)" ]; then echo "$(git describe --tags --always --dirty=-dev 2> /dev/null )"; else if [ -f "$VERSFILE" ]; then . "$VERSFILE"; echo "${MAJOR}.${MINOR}.${BUILD}"; else echo "0.0.0"; fi; fi ) | tr -d '\n' ]))
4+
AC_CONFIG_SRCDIR([mod_cloudflare.c])
5+
AC_PREREQ([2.53])
6+
7+
AC_CHECK_FUNCS([strrchr])
8+
9+
AC_ARG_WITH(apxs, AC_HELP_STRING([--with-apxs=NAME],
10+
[name of the apxs executable [[apxs]]]),
11+
[APXS="$with_apxs"])
12+
13+
if test -z "${APXS}"; then
14+
AC_PATH_PROGS(APXS, apxs2 apxs, [apxs],
15+
[$PATH:/usr/local/apache/bin:/usr/sbin])
16+
fi
17+
18+
AC_SUBST(APXS)
19+
20+
AC_MSG_CHECKING(Apache version)
21+
HTTPD="`${APXS} -q SBINDIR`/`${APXS} -q TARGET`"
22+
HTTPD_INCLUDEDIR="`${APXS} -q INCLUDEDIR`"
23+
if test -x ${HTTPD}; then
24+
HTTPD_VERSION=`${HTTPD} -v | awk '/version/ {print $3}' \
25+
| awk -F/ '{print $2}'`
26+
else
27+
if test -f ${HTTPD_INCLUDEDIR}/ap_release.h; then
28+
HTTPD_VERSION=`grep '^#define AP_SERVER_MAJORVERSION_NUMBER ' \
29+
${HTTPD_INCLUDEDIR}/ap_release.h | sed -e \
30+
's/^#define AP_SERVER_MAJORVERSION_NUMBER \([0-9]\).*/\1.X/'`
31+
else
32+
if test -f ${HTTPD_INCLUDEDIR}/httpd.h; then
33+
HTTPD_VERSION=`grep '^#define APACHE_RELEASE ' \
34+
${HTTPD_INCLUDEDIR}/httpd.h | sed -e \
35+
's/^#define APACHE_RELEASE \([0-9]\).*/\1.X/'`
36+
else
37+
HTTPD_VERSION="2.?"
38+
fi
39+
fi
40+
fi
41+
AC_MSG_RESULT($HTTPD_VERSION)
42+
43+
CPPFLAGS="${CPPFLAGS}"
44+
CFLAGS=""
45+
LDFLAGS="${LDFLAGS}"
46+
LDLIBS="${LDLIBS}"
47+
48+
AC_SUBST(CPPFLAGS)
49+
AC_SUBST(CFLAGS)
50+
AC_SUBST(LDFLAGS)
51+
AC_SUBST(LDLIBS)
52+
53+
LIBEXECDIR="`${APXS} -q LIBEXECDIR`"
54+
AC_SUBST(LIBEXECDIR)
55+
56+
HTTPD_MAJOR_VERSION=`echo ${HTTPD_VERSION} | sed -e 's/\..*//'`
57+
58+
AC_OUTPUT([Makefile])

mod_cloudflare.c

+9
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,18 @@ static int cloudflare_modify_connection(request_rec *r)
278278
char *eos;
279279
unsigned char *addrbyte;
280280
void *internal = NULL;
281+
const char *cf_visitor_header = NULL;
281282

282283
apr_pool_userdata_get((void*)&conn, "mod_cloudflare-conn", c->pool);
283284

285+
cf_visitor_header = apr_table_get(r->headers_in, "CF-Visitor");
286+
if (cf_visitor_header != NULL) {
287+
if ((remote) && (strstr(cf_visitor_header, "https") != NULL)) {
288+
apr_table_t *e = r->subprocess_env;
289+
apr_table_addn(e, "HTTPS", "on");
290+
}
291+
}
292+
284293
if (conn) {
285294
if (remote && (strcmp(remote, conn->prior_remote) == 0)) {
286295
/* TODO: Recycle r-> overrides from previous request

0 commit comments

Comments
 (0)