Closed arladmin closed 5 months ago
Works fine for me:
-Created Hello World app
-Deployed to folder
-Ran http-server
in folder
-open in browser, all good
@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:
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.
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.
Like i said, the deployment should work from any subfolder if the deployed code is adjusted for the above.
The Base URL should be an absolute URL, otherwise the Page Router wont work.
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?
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.
@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.
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.
To deploy at
https://example.com/sub1/sub2/
you need to setNoodl.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.
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](https://github.com/noodlapp/noodl/assets/64059154/813e3136-f521-43fb-a83c-d8968d6b960f)