Custom URL Paths for Web Apps
Custom URL paths allow you to modify the base URL of your web apps. This configuration is useful when deploying applications behind a reverse proxy server, such as NGINX. By setting up custom URL paths, you can ensure that your applications are accessible through specific URL structures required by your organization's infrastructure.
Set Up Custom URL Paths
Install and configure the MATLAB® Web App Server™.
Ensure that the MATLAB Web App Server is installed and running on your system.
Verify that the server is accessible using its default URL.
Set up a reverse proxy server.
Install and configure a reverse proxy server, such as NGINX. This server will handle incoming requests and map them to the correct URL paths.
Edit the reverse proxy server's configuration file.
Open the NGINX configuration file and add a new server block to define the custom URL path.
Specify the server name, listen port, and location block for the custom path.
Configure URL mapping.
Inside the location block, use the
proxy_pass
directive to forward requests to the MATLAB Web App Server.Use
proxy_redirect
andrewrite
directives to adjust the request paths as needed.
Restart the reverse proxy server.
After editing the configuration file, restart the NGINX server to apply the changes.
Example Configuration
The original URL for accessing MATLAB Web App Server is typically structured as:
http://<webappserver_domain>:<webappserver_port>/webapps/home
The custom URL is structured as:
http://<proxy_domain>:<proxy_port>/<context>/<root>/webapps/home
Suppose you want to set up a custom URL path for a project named DataAnalytics for a client Acme. The custom URL to access the MATLAB Web App Server home page will be:
https://proxy.example.com:9993/acme/dataanalytics/appserver/webapps/home
For example, here's how you can configure NGINX:
events {
worker_connections 1024;
}
http {
client_max_body_size 100M;
server {
listen 0.0.0.0:9993 ssl default_server;
server_name proxy.example.com;
ssl_certificate /path/to/your/certificate.crt;
ssl_certificate_key /path/to/your/private.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
client_max_body_size 100M;
location /acmecorp/dataanalytics/ {
proxy_pass https://webappserver.example.com:9988/;
proxy_redirect / /acme/dataanalytics/;
rewrite ^/acme/dataanalytics/?(.*) /$1 break;
client_max_body_size 100M;
}
}
}
In this configuration:
The NGINX server listens on port
9993
.The custom URL path is
/acme/dataanalytics/
.Requests to this path are forwarded to MATLAB Web App Server running on
http://webappserver.example.com:9988/
.The
client_max_body_size
property is set to100M
. Set this property to 100 megabytes or more to avoid errors when attempting to upload apps from the Manage Apps link on the server home page.