reverse-proxy with nginx in a iocage

Status
Not open for further replies.

pakka

Dabbler
Joined
Jan 25, 2018
Messages
48
hi,

I tried to install a reverse-proxy server with nginx in a jail like described here: https://www.smarthomeng.de/developer/plugins/alexa/nginx.html?highlight=nginx

all went well and I have access from the www to my smartVISU with this configuration:
Code:
	  # Zugriff auf die SmartVISU
location /smartVISU {
		auth_basic "Restricted Area: smartVISU";
		auth_basic_user_file /usr/local/etc/nginx/.smartvisu;

		# Zugreifendes Land erlaubt?
		if ($allowed_country = no)  {
				return 403;
		}

		proxy_pass http://192.168.0.7/smartVISU;
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto $scheme;
}


But the same configuration does not work with a redirection to my fritzbox or homematic-server:

#Fritzbox
location /Fritzbox {

auth_basic "Zugriffsgeschützes Dingsbums";
auth_basic_user_file /usr/local/etc/nginx/.smarthomeng;

# Zugreifendes Land erlaubt?
if ($allowed_country = no) {
return 403;
}

proxy_pass http://192.168.0.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

# Homematic
location /homematic {

# Clientzertifikat gültig?
if ($ssl_client_verify != SUCCESS) {
return 403;
}

# Zugreifendes Land erlaubt?
if ($allowed_country = no) {
return 403;
}

proxy_pass http://192.168.0.25;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}


For the Fritzbox site I see a blank page only with a title "FritzBox!", in case of the homematic server I get an error "ERR_CONTENT_LENGTH_MISMATCH".
Can anyone explain what´s the difference between them and why the smartVISU site works great and the other doesn´t?
thank you so much!
 
Status
Not open for further replies.
Top