File apache2-mod_xforward.spec of Package apache2-mod_xforward

#
# spec file for package apache2-mod_xforward
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define _pkg_name apache2-mod_xforward

%if 0%{?suse_version}
Name:           apache2-mod_xforward
BuildRequires:  apache2-devel
Requires:       apache2
%if ! %{defined apache_apxs}
%define apache_apxs /usr/sbin/apxs2
%endif
%define apache apache2
%else
Name:           mod_xforward
BuildRequires:  httpd-devel
Requires:       httpd
%if ! %{defined apache_apxs}
%define apache_apxs /usr/bin/apxs
%endif
%define apache  httpd
%endif
%define apache_libexecdir %(%{apache_apxs} -q LIBEXECDIR)
%define apache_sysconfdir %(%{apache_apxs} -q SYSCONFDIR)
%define apache_includedir %(%{apache_apxs} -q INCLUDEDIR)
%define apache_serverroot %(%{apache_apxs} -q PREFIX)
%define apache_localstatedir %(%{apache_apxs} -q LOCALSTATEDIR)
%define apache_mmn        %(MMN=$(%{apache_apxs} -q LIBEXECDIR)_MMN; test -x $MMN && $MMN)
Version:        0.6
Release:        0
URL:            https://www.gitorious.org/opensuse/apache2-mod_xforward
%if 0%{?suse_version}
Requires:       %{apache_mmn}
%endif
Summary:        Apache module implementing handling of X-FORWARD headers
License:        Apache-2.0
Group:          Productivity/Networking/Web/Servers
Source:         %{_pkg_name}-%{version}.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The xforward module implements internal redirection based on X-Forward response header.
When this header is seen by Apache it uses the apache mod_proxy module to proxy the
given URL.
This is not visible for the client process and can be used to free the cgi/rails
process pool by long running requests after initial check routines.

%prep
%setup -n %{_pkg_name}

%build
%{apache_apxs} -c mod_xforward.c

%install
mkdir -p $RPM_BUILD_ROOT/%{apache_libexecdir}
cp -p .libs/mod_xforward.so $RPM_BUILD_ROOT/%{apache_libexecdir}
%if 0%{?fedora} || 0%{?rhel}
mkdir -p $RPM_BUILD_ROOT/etc/httpd/conf.modules.d/
echo "LoadModule xforward_module modules/mod_xforward.so" >  $RPM_BUILD_ROOT/etc/httpd/conf.modules.d/01-xforward.conf
%endif

%files
%defattr(-,root,root)
%{apache_libexecdir}/*.so
%if 0%{?fedora} || 0%{?rhel}
%config /etc/httpd/conf.modules.d/01-xforward.conf
%endif

%changelog