Title: How to use Apache 2.4 as a reverse proxy server for TeamPage and a temporary webpage during TeamPage's shutdown

One of the Japanese customers wants to have a temporary webpage which would tell visitors that "TeamPage is being shut down. Please wait." during their TeamPage's shutdown for maintenance. I recommended building an Apache HTTP server as a reverse proxy server as a frontend of TeamPage as follows. I hope this document will be helpful for the customers who are considering to have ones on Windows.



Images



Connect to TeamPage Directly





Connect to TeamPage via Apache Proxy





System Requirements



In this document, I'm going to introduce the "how to" for the Windows environment since the customer is running TeamPage on Windows.

The latest version of TeamPage uses web sockets. Apache 2.2 doesn't support web sockets, so please select Apache 2.4.

Here are what I used for this case.



The both of TeamPage and Apache are installed on the same computer by the name of "winvm.local". TeamPage uses HTTP 8080 port and Apache uses 80.

Download Apache



Download an Apache binary zip package from https://www.apachelounge.com/download/.

I chose "2.4.33 VC15" for 64bit Windows.



Install Apache



Extract httpd-2.4.33-win64-VC15.zip and move the internal "Apache24" folder to the root folder of the C: drive so that the installation folder is "C:\Apache24". Here is a screenshot taken on a Japanese Windows.



Apache Configurations



Basic (ServerName)



Open the "httpd.conf" file in the "conf" folder with your text editor.

Cancel the comment-out by removing the "#" character at the beginning of the line to set up the ServerName.

ServerName  winvm.local


Test Run



Launch the "Command Prompt" tool as administrator, go to the "C:\Apache24\bin" folder, type "httpd", and press Enter key to run Apache. The console looks like the "httpd" is freezing but it is an expected behavior. If you want to stop Apache, press Ctrl + C.



If you get an error something like "Can not start the program because VCRUNTIME140.dll is not installed on this computer.", go to microsoft.com/en-…, download Visual C++ Redistributable for Visual Studio 2015, and install it.

When you go to http://winvm.local/ by using your web browser, you would see the following "It works!" view. This is the simple default web page provided by Apache. Now you confirmed that Apache is working.



Reverse Proxy Configurations



Open the "httpd.conf" file in your text editor and remove the "#" characters in the following lines.

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so


Add the following descriptions to the end of the "httpd.conf" file and save the file.

Alias /error/ "c:/Apache24/error/"
<Directory "c:/Apache24/error/">
AllowOverride None
Options IncludesNoExec
AddOutputFilter Includes html
AddHandler type-map var
Require all granted
</Directory>

ProxyRequests Off
ProxyErrorOverride On
ErrorDocument 503 /error/503.html
ProxyPass /error/ !
ProxyPass /ws ws://localhost:8080/ws
ProxyPassReverse /ws ws://localhost:8080/ws
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/


Test Run



Shutdown the "httpd" on the console by pressing Ctrl + C, and re-run "httpd" so that Apache load the changes you made above in the "httpd.conf" file.

Now Apache is supposed to work as a reverse proxy server. When you go to http://winvm.local/, you would see the TeamPage view instead of the "It works" view.



Congratulations! Now you've set the Apache HTTP reverse proxy server between your browser and TeamPage server.

Temporary Web Page



If TeamPage is being shut down behind the Apache reverse proxy server when a user attempt to go to TeamPage via Apache, Apache would detect that TeamPage doesn't respond and display a "HTTP Error 503" message on the user's browser.

You can customize the HTML file for this error to let the user know that TeamPage is being shut down because of, for example, a regular maintenance.

In the step above, you added the following line to the "httpd.conf" file. This means "when a 503 error occur, display the '503.html' file in the 'error' folder."

ErrorDocument 503 /error/503.html


So what you should do is putting these 3 files into the "C:\Apache24\error" folder.



You would see the following view when you go to the site during TeamPage's shutdown.



Related Articles



Support2016



Attachments:
image1.png
image2.png
apache_win64_download.png
install_folder.png
02_apache_running1.png
03_apache_running2.png
04_tp_fp.png
503.html
error.css
ojigi_animal_inu.png
06_oops.png
Article: Support3825 (permalink)
Categories: :Doc:FAQ
Date: May 9, 2018; 10:53:12 PM Eastern Daylight Time

Author Name: Takashi Okutsu
Author ID: takashi