framework: support for nginx reverse proxy
Document and write an example in demoservice package to create a publication alias in DSM nginx to publish a service running on its custom port
Afaik everything is done by the user: https://kb.synology.com/en-ca/DSM/help/DSM/AdminCenter/system_login_portal_advanced?version=7
Since DSM 7.0 it is possible to configure a reverse proxy for packages. Example from developer guide:
reverse_proxy service worker setting example:
{
"service": "gitlab",
"display_name": "Git Lab",
"support_alias": true,
"support_server": true,
"type": "reverse_proxy",
"icon": "ui/gitlab_{0}.png",
"proxy_target": "http://gitlab:30000",
"proxy_headers": [{
"name": "host",
"value": "gitlab"
},{
"name": "Upgrade",
"value": "$http_upgrade"
},{
"name": "Connection",
"value": "$connection_upgrade"
}]
"connect_timeout": 60,
"read_timeout": 3600,
"send_timeout": 60
}
@ymartin59 I tried to create a reverse proxy for the new demowebservice package in #5649
I added the following code to the resource file, but it did not create a reverse proxy (package installation on DSM 7 did succeed without any error)
{
"service": "demowebserviceproxy",
"display_name": "Demo Web Service Proxy",
"icon": "app/images/demowebservice-{0}.png",
"type": "reverse_proxy",
"proxy_target": "http://localhost:8889",
}
Manual creation of a reverse proxy works as expected.
And the system created/updated the reverse proxy config file /usr/syno/etc/www/ReverseProxy.json
The entry for the demowebservice looks like
"e6c61973-83e4-4ca2-a132-b9ab56357301" :
{
"backend" :
{
"fqdn" : "localhost",
"port" : 8889,
"protocol" : 0
},
"customize_headers" : [],
"description" : "Demo Web Service Proxy",
"frontend" :
{
"acl" : null,
"fqdn" : null,
"https" :
{
"hsts" : false
},
"port" : 8443,
"protocol" : 1
},
"proxy_connect_timeout" : 60,
"proxy_http_version" : 1,
"proxy_intercept_errors" : false,
"proxy_read_timeout" : 60,
"proxy_send_timeout" : 60
},
Since there are no properties for the source (frontend) of a reverse proxy documented in the DSM 7 Developer Guide by Synology, I suppose that either the documentation is incomplete or it is not possible to create a "reverse_proxy" service.