noodlapp / noodl

Noodl is a low code platform for creating full stack web applications
https://noodl.net
GNU General Public License v3.0
281 stars 69 forks source link

Deployed app is broken #8

Closed arladmin closed 5 months ago

arladmin commented 5 months ago

Using the Windows binary here.

Created a fresh project using the Task Manager template (no customization at all), and deployed it to a web server.

Errors: image

mikaeltellhed commented 5 months ago

Works fine for me: -Created Hello World app -Deployed to folder -Ran http-server in folder -open in browser, all good

arladmin commented 5 months ago

@mikaeltellhed Did you upload it to a subfolder, or the root folder?


The issue's when it's uploaded to a subfolder, because the index.html is using relative paths referencing the root folder, instead of the current folder: image

mikaeltellhed commented 5 months ago

No not subfolder, just ran the web server locally from the folder so technically root. Might be an issue when running from subfolder yes correct.

arladmin commented 5 months ago

No not subfolder, just ran the web server locally from the folder so technically root. Might be an issue when running from subfolder yes correct.

@mikaeltellhed

For example, if i set the Custom Base URL = ./ , it deploys correctly. image

Like i said, the deployment should work from any subfolder if the deployed code is adjusted for the above.

erictuvesson commented 5 months ago

The Base URL should be an absolute URL, otherwise the Page Router wont work.

arladmin commented 5 months ago

The Base URL should be an absolute URL, otherwise the Page Router wont work.

@erictuvesson

Does that imply that the nested subfolder deployments won't work, unless the absolute path is provided?

Basically, if the app needs to be deployed at https://example.com/sub1/sub2/ , Noodl.Env.BaseUrl has to be equal to https://example.com/sub1/sub2/?

And, Noodl.Env.BaseUrl = ./, or Noodl.Env.BaseUrl = default, will not work?

erictuvesson commented 5 months ago

When hosting in a subfolder the app always needs to know the origin URL from where to fetch the required resources.

If you want to deploy the app to https://example.com/sub1/sub2/, then the Base URL should be https://example.com/sub1/sub2/.

The Page Router also requires knowledge for where it originates from.

arladmin commented 5 months ago

@erictuvesson

I'm a bit confused here.


When hosting in a subfolder the app always needs to know the origin URL from where to fetch the required resources.

Shouldn't Noodl.Env.BaseUrl = ./ cover this then?

It also has an added advantage of the flexibility to deploy the same app to any number of subdomains, without the hindrance of changing the Noodl.Env.BaseUrl variable every time.

michaelcartner commented 5 months ago

To deploy at https://example.com/sub1/sub2/ you need to set Noodl.Env.BaseUrl = https://example.com/sub1/sub2/ as relative paths will break some important part of the apps.

If you're familiar with how other javascript build systems work it's similar to Webpack's publicPath config or Vite's base config.

arladmin commented 5 months ago

To deploy at https://example.com/sub1/sub2/ you need to set Noodl.Env.BaseUrl = https://example.com/sub1/sub2/ as relative paths will break some important part of the apps.

Oh. Too bad.

Would have been way more convenient if it was a possibility to deploy an app to multiple subfolders without having to configure the BaseUrl every time, just like one can do with static websites.