Skip to content

Run Specmate behind a reverse proxy

junkerm edited this page Oct 22, 2020 · 1 revision

To run specmate behind a reverse proxy server, make sure that your reverse proxy server passes the Host: ... line from the incoming request to the specmate server, instead of the target hostname specified in your reverse proxy config. If you don't do this, login at specmate will not work.

Use the following commands:

  • proxy_set_header host $host; for nginx
  • ProxyPreserveHost on for Apache httpd

Example config - nginx

events { worker_connections 1024; }

http {

	server {
	    listen       8081;						

	    location / {
		proxy_redirect off;					# disables forward-proxying
		proxy_set_header host $host;				# this here is necessary, otherwise specmate auth-cookies will not work anymore
		proxy_pass	http://specmate-server:8080;	# the actual reverse proxy command
	    }
	}
}

Example config - apache Apache httpd

LoadModule mpm_event_module modules/mod_mpm_event.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule unixd_module modules/mod_unixd.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule ssl_module modules/mod_ssl.so

LoadModule headers_module modules/mod_headers.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_html_module modules/mod_proxy_html.so

Listen 8082
ServerName localhost

User daemon
Group daemon

ServerAdmin [email protected]
Errorlog /dev/stderr

<VirtualHost *:8082>				
    ProxyRequests off						# disables forward-proxying   
    ProxyPreserveHost on					# this here is necessary, otherwise specmate auth-cookies will not work anymore

    <Location />
	
	# the actual reverse proxy command
        ProxyPass http://specmate-server:8080/		
        ProxyPassReverse http://specmate-server:8080/
        Order allow,deny
        Allow from all
    </Location>

</VirtualHost>