wireui / wireui

TallStack UI components
https://v1.wireui.dev
MIT License
1.37k stars 166 forks source link

Problems with applications in subdirectories #246

Closed kai0310 closed 1 year ago

kai0310 commented 2 years ago

Describe the bug This occurs when the application is placed in a subdirectory.

The APP_URL and ASSET_URL also include subdirectories, but this does not work.Some sexuals, such as modals, will work, but may not work with respect to those that publish URLs at the same time they work.

For example, in the example using dialog, the following URL is issued without subdirectories.

Application URL: https://example.com/app/ Output URL: https://example.com/wireui/button?method=deletePost&params=Saved&...... Expect URL: https://example.com/app/wireui/button?method=deletePost&params=Saved&......

PH7-Jack commented 1 year ago

Why the expected URL must include the subdirectories? The resource is the same for all tenant

PH7-Jack commented 1 year ago

Could you explain more your issue?

kai0310 commented 1 year ago

@PH7-Jack Thanks for the reply!

This is because the application is located in a subdirectory. Therefore, if a subdirectory is not in the URL, a 404 error is returned. Since wireui is set up in the application, of course the URL must be issued with the subdirectory in which the application is located.

There is a way to use a subdomain, but I would like to know what the solution would be if I were to install in a subdirectory.

Please let me know if I'm not explaining it well enough.

PH7-Jack commented 1 year ago

I'm sorry, but I didn't understand completely You have an application running in a subdirectory

/root/web/app/app-1
/root/web/app/app-2

You have a DNS record point to your server Your Nginx or Apache is serving your domain example.com with the /root/web/app/ directory And the app-1and app-2 is accessible in the same URL

example.com/app-1/home
example.com/app-2/home

Is that? If so, it's not the better way to server multiples apps in the same URL, you can use the wildcard subdomains

app-1.example.com
app-2.example.com

Otherwise, the wireui will use the laravel route provider to server the wireui route, I can't change the route provider, but you can create your own API to this, just register this controller in your web route with a path that you want. Add a script tag in the HTML to fetch the assets in the new route. Another thing that you need to do is create a custom directive to the wireui hooks scripts https://github.com/wireui/wireui/blob/main/src/Support/BladeDirectives.php#L20

PH7-Jack commented 1 year ago

Old issue, closing it now. Tag me to re-open if your problem still persists

undjike commented 1 year ago

@PH7-Jack I don't know if it's the right place for that but it seems to go the same way.

I have issue with icons when serving application in a subdirectory. I mean the app is not at the root url. Ex: http://localhost/appname.

I have updated the .env file accordingly.

APP_URL=http://localhost/appname

Note: Notifications work (without the icon showing) and I have a icon related error in the console (404 Not Found). And I'm seeing that the path is not good (http://localhost/wireui/icons/outline/check-circle instead of http://localhost/appname/wireui/icons/outline/check-circle).

This strange message displays behind the notification:

This page contains the following errors: error on line 1 at column 50: Space required after the Public Identifier Below is a rendering of the page up to the first error.

undjike commented 1 year ago

@PH7-Jack any solution?

undjike commented 1 year ago

I've cleared cache, config and view no change.

image

kai0310 commented 1 year ago

@undjike

It seems that it is not intended to put the application directly in a subdirectory.

As mentioned here, for example, edit the hosts and apply the application's subdomain.

undjike commented 1 year ago

Alright, thanks @kai0310 .

safwanAzman commented 1 year ago

any solution ?

swartjie commented 9 months ago

I am having the same problem. Is it not possible to have the WireUI url for resources, either use the APP_URL from the .env file or use a variable in it's config? In my case I have a project on localhost in a sub folder, but the files being loaded go right to http://localhost:8080/wireui/icons/outline/check-circle for example, instead of the project folder which is http://localhost:8080/myproject/wireui/icons/outline/check-circle

LaMance22 commented 8 months ago

I have the same problem as @swartjie error