2

I have got a couple of Laravel applications that use Nova. All these apps are accessible using the same domain but under different paths. For example, consider following the directory structure & domain.

Domain: my-domain.com

Directory structure:

- Web server root dir
   - apps
       - app 1
       - app 2

- App dir
   - App 1
   - App 2

The above apps can be accessed via my-domain.com\apps\app-1 and my-domain.com\apps\app-2

app 1 and app 2 directories are symlinks to the public directory of the actual Laravel applications(Eg, App dir > App 1 & App dir > App 2). The Laravel application is working as expected, but Nova is not.

When I try to access the Nova app via my-domain.com\apps\app-1\nova\login all I get is an empty page with some errors on the browser console that shows the invalid path to the CSS/JS files(see the screenshot). The subdirectory path is not added when the assets are loaded.

Screenshot

I tried to fix this issue by following this solution and creating the layout file inside resources/views/vendor/nova/layout.blade.php by copying the contents from vendor/laravel/nova/resources/views/layout.blade.php and loading the asset files using the asset() helper. This resolved the issue and the Nova login page is working. However, after the page loading is finished the URL is altered and the subdirectory path is appended. So the initial login URL my-domain.com\apps\app-1\nova\login is automatically changed to my-domain.com\apps\app-1\apps\app-1\nova\login and nothing else will work thereafter. For example, submitting the login form will send a request to my-domain.com\nova\login which results in a 404.

I saw another thread similar to this issue but couldn't find any solution. There is also another issue which says Nova does not support the subdirectory implementation.

Note: I understood this is not a proper way to implement Laravel apps but I can't rewrite the whole application due to this issue.

Thank you

2
  • Oh this is well known problem with Nova it seems, Nova's design assumes that it's hosted at the root of your domain, and it doesn't natively support subdirectories out of the box . Can you try to use a reverse proxy, like Nginx or Apache, to rewrite URLs and serve Nova from a subdirectory. Commented Nov 5, 2023 at 8:06
  • is the vendor in Web server root dir ? Commented Nov 7, 2023 at 16:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.