[SOLVED] After DSM 6.0 update, reverse proxy is not working

Questions about HTTP Access/Mods may go here
Forum rules
Synology Community is the new platform for the enthusiasts' interaction, and it will soon be available to replace the Forum.
wrightie
I'm New!
I'm New!
Posts: 6
Joined: Tue Aug 26, 2014 2:06 pm

[SOLVED] After DSM 6.0 update, reverse proxy is not working

Unread post by wrightie » Fri Mar 25, 2016 2:36 pm

!!!HELP!!!
Tonight DSM upgraded to v6; now I have problems with a reverse proxied server I can't properly access anymore, and the Redmine service that the server hosts is fundamental for a work I'm completing, for which I have a very limited time.

Up to DSM 5, there was a httpd-vhost.conf-user file in /etc/httpd/sites-enabled-user which, among other things, sets up a reverse proxy to a LAN server running Redmine on port 5000. It worked fine till today (this is a subset of the complete file):


#Manually added to implement reverse proxying to 192.168.1.202
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
ProxyRequests Off

#Additional ports to listen to
Listen 5000

#NameVirtualHosts
NameVirtualHost *:5000
NameVirtualHost *:80

#-----------
#- Redmine -
#-----------
<VirtualHost *:5000>
ServerName s***i.e***o.com
#DocumentRoot "/volume1/web/redmine"
#ErrorDocument 403 "/webdefault/sample.php?status=403"
#ErrorDocument 404 "/webdefault/sample.php?status=404"
#ErrorDocument 500 "/webdefault/sample.php?status=500"

#Manually added to implement reverse proxying to 192.168.1.202
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://192.168.1.202:5000/
ProxyPassReverse / http://192.168.1.202:5000/
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>



Now the WebStation is a service itself, and it looks like the new folder for httpd-vhost.conf-user is /usr/local/etc/httpd/sites-enabled; but the file can't be manually edited, as it's automatically rewritten every time the package is started/restarted.
Ok, no manual changes.
There's a reverse proxy interface under the app portal menu of the control panel; I set it up (see below), but it does not work: it loses the port reference when it changes page:

Description: redmine
Source: protocol-HTTP; hostname-s***i.e***o.com; port-5000
Destination: protocol-HTTP; hostname-192.168.1.202; port-5000


Questions are:
* where is the conf file for the reverse proxy settings now?
* is it overwritten from scratch every time you change something in the web interface or you restart the DiskStation, or can it be modified? Will it keep my changes?
* if it's not going to work, how can I restore the reverse proxy settings that worked with DSM v5? What conf file can I edit?

I'm thanking you all in advance; as I already stated, it's urgent as this problem is blocking an important project I'm working at.

wrightie
Last edited by wrightie on Sat Apr 02, 2016 5:01 pm, edited 2 times in total.
...Proud owner of a bunch of Synology Diskstation Servers...
Check my Synology blog at http://www.wrightie.eu/

wiz561
Rookie
Rookie
Posts: 35
Joined: Wed Jan 11, 2012 8:08 pm

Re: After DSM 6.0 update, reverse proxy is not working

Unread post by wiz561 » Fri Mar 25, 2016 3:36 pm

I'm not sure if this is the right way to do it or not, but it looks like the conf files may had been moved from...

/etc/httpd/sites-enabled-user/ to /usr/local/etc/httpd/sites-enabled/

I also had to rename the file so it ended in .conf instead of .conf-user-8-27-something. After doing this and restarting, my reverse proxy started working again.

wrightie
I'm New!
I'm New!
Posts: 6
Joined: Tue Aug 26, 2014 2:06 pm

Re: After DSM 6.0 update, reverse proxy is not working

Unread post by wrightie » Fri Mar 25, 2016 7:40 pm

wiz561 wrote:I'm not sure if this is the right way to do it or not, but it looks like the conf files may had been moved from...

/etc/httpd/sites-enabled-user/ to /usr/local/etc/httpd/sites-enabled/

I also had to rename the file so it ended in .conf instead of .conf-user-8-27-something. After doing this and restarting, my reverse proxy started working again.
You saved me! Now it's all working fine!!!
I removed the reverse proxy definition from the app portal menu of the control panel, moved my config file and added a ".conf" suffix; then I restarted the service with:

sudo /usr/syno/sbin/synoservicecfg --restart pkgctl-WebStation

...and it worked!!!!
Thanks a lot!

wrightie
...Proud owner of a bunch of Synology Diskstation Servers...
Check my Synology blog at http://www.wrightie.eu/

Jaybeam
I'm New!
I'm New!
Posts: 6
Joined: Wed Jul 08, 2015 5:11 pm

Re: [SOLVED] After DSM 6.0 update, reverse proxy is not working

Unread post by Jaybeam » Sat Mar 26, 2016 5:59 pm

Could you please given an example off the contents of your file and what you named it because for no matter what I try, my files get replaced by the syno ones.

Grtz,
Rudy.

GiovannieR
Trainee
Trainee
Posts: 18
Joined: Fri Mar 25, 2016 1:41 pm

Re: [SOLVED] After DSM 6.0 update, reverse proxy is not working

Unread post by GiovannieR » Mon Mar 28, 2016 4:52 pm

if your config located in /usr/local/etc/httpd/sites-enabled/ and not named httpd-vhost.conf-user but httpd-vhost.conf for example.

<VirtualHost *:80 *:443>
ServerName mydomain.tld
SetEnv HOST mydomain.tld
ServerAlias sub.mydomain.tld
DocumentRoot "/path/to/folder"
<IfModule dir_module>
DirectoryIndex index.html index.htm index.cgi index.php index.php5
</IfModule>
<Directory "/path/to/folder">
Options MultiViews FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>

<IfModule fastcgi_module>
AddHandler default-handler .htm .html .shtml
AddHandler php5-fastcgi .php .php3 .php4 .php5 .phtml
AddType text/html .php .php3 .php4 .php5 .phtml
Action php5-fastcgi /php-fpm-handler.fcgi
ScriptAlias /php-fpm-handler.fcgi /php-fpm-handler
</IfModule>

</VirtualHost>

this is one entry of my httpd-vhost.conf file (using the default layout)

If your files located in "/usr/local/etc/httpd/sites-enabled/" is gone, the config is refused/rejected. and the system wil create a new folder in "/usr/local/etc/httpd/" named for example: "sites-enabled.Yds3Y" with you config in it.
it will create a new folder everytime your config gets refused/rejected. You will also get a warning in DSM manager (webinterface)

User avatar
lotsacaffeine
Beginner
Beginner
Posts: 21
Joined: Sun Jan 31, 2016 11:04 pm
Location: Murfreesboro, TN
Contact:

Re: [SOLVED] After DSM 6.0 update, reverse proxy is not working

Unread post by lotsacaffeine » Tue Mar 29, 2016 8:53 am

You might also want to check out these directories and files...

/var/package/WebStation/
/var/package/WebStation/etc
/var/package/WebStation/etc/VirtualHost.json
Hardware: DS1513+ NAS (4GB RAM, x5 WD RED 4TB), DX 513 (x5 WD RED 3TB), ASUS RT-AC68U WiFi Router, APC Back-UPS Pro 1500 (BR1500G), Comcast Business Gateway (5-fixed IPs).
Configured: Win/Mac FileServer (TimeMachine), DNS Server (2 domains, x2 LAN ports), Photo Station, Download Station, Video Station, Surveillance Station (x3 PTZ/IP cams), Audio Station, Mail Server, Media Server, VPN Server, Web Station-Virtual Hosts (x3 WordPress Blogs, phpBB)
DSM Version: 6.0-7321 Update 3

Jaybeam
I'm New!
I'm New!
Posts: 6
Joined: Wed Jul 08, 2015 5:11 pm

Re: [SOLVED] After DSM 6.0 update, reverse proxy is not working

Unread post by Jaybeam » Thu Mar 31, 2016 3:23 pm

The thing I'm trying to do is forward anything that arrives on my domain on the ssl port with sub-domain "transmission", to my transmission web-gui in http.
Transmission doesn't support https and this worked perfectly on DSM5.2. On DSM 6 however it keeps getting rejected.

<VirtualHost *:443>
ServerName http://www.j*****m.be
DocumentRoot "/var/services/web"
ErrorDocument 403 "/webdefault/error.html"
ErrorDocument 404 "/webdefault/error.html"
ErrorDocument 500 "/webdefault/error.html"
SSLEngine on

ProxyPass /transmission/ http://192.168.20.105:9091/transmission/
ProxyPassReverse /transmission http://192.168.20.105:9091/transmission/

</VirtualHost>

GiovannieR
Trainee
Trainee
Posts: 18
Joined: Fri Mar 25, 2016 1:41 pm

Re: [SOLVED] After DSM 6.0 update, reverse proxy is not working

Unread post by GiovannieR » Fri Apr 01, 2016 1:45 am

Jaybeam wrote:The thing I'm trying to do is forward anything that arrives on my domain on the ssl port with sub-domain "transmission", to my transmission web-gui in http.
Transmission doesn't support https and this worked perfectly on DSM5.2. On DSM 6 however it keeps getting rejected.

<VirtualHost *:443>
ServerName http://www.j*****m.be
DocumentRoot "/var/services/web"
ErrorDocument 403 "/webdefault/error.html"
ErrorDocument 404 "/webdefault/error.html"
ErrorDocument 500 "/webdefault/error.html"
SSLEngine on

ProxyPass /transmission/ http://192.168.20.105:9091/transmission/
ProxyPassReverse /transmission http://192.168.20.105:9091/transmission/

</VirtualHost>
why the http:// in front of your servername
Let me help you.

and the virtualhost is just:

<VirtualHost *:80 *:443>
ServerName http://www.j*****m.be
DocumentRoot "/var/services/web"
ErrorDocument 403 "/webdefault/error.html"
ErrorDocument 404 "/webdefault/error.html"
ErrorDocument 500 "/webdefault/error.html"
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
</VirtualHost>

try to add the reverse proxy in the web gui, or check in /usr/local/etc/nginx/conf.d/ if there is already a .conf for the transmission(cant check dont have transmission running) else i think you need to create a conf.

For example the file http://www.Transmission.conf:

with the entries:
server_name http://www.j*****m.be;
location ^~ /transmission {
include proxy.conf;
proxy_pass http://192.168.20.105:9091/transmission/;
}


maybe also:
proxy_redirect http://www.j*****m.be/transmission/ https://www.j*****m.be/transmission/;

or with: port_in_redirect off;
or both (add lines under proxy_pass.)

it will do the proxy only for "www.j*****m.be" and listens only on 443. Again i cant test this, but trying to help. dont know the location where the gui saves the config, still looking for that :)


Post Reply

Return to “HTTP/Apache Mods”