Broken asset links on NGINX

When you’re not using a subdomain or custom domain, the only way to access a tenant is through the URL path scheme, like this:https://yoursaas.com/tenantid/rs/.

Sometimes, Nginx users encounter broken assets or links when using the URL path for tenants. In such cases, it’s important to ensure that all requests, especially for static assets, are directed to the application (CRM) before showing a 404 error.

We can achieve this by excluding requests for assets with the tenant path ID from being served as static files. Instead, they should be passed to the application (CRM), where the SaaS handles dynamic content or shows a 404 error when necessary.

For example, consider the highlighted path below:

location ~* ^(?!.*/rs/).*\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|woff2|eot|mp4|ogg|ogv|webm|webp|zip|swf|map)$ {

    expires max;

    access_log off;

}

It’s important to note that this setup isn’t necessary if your tenant is using a subdomain or custom domain.

Powered by BetterDocs

Scroll to Top