You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Why does UI5 tooling serve a directory index? #623
We are so used to getting index.html served over any other file (if present) when requesting '/'.
What is the reasoning for requiring an explicit request to index.html?
After a couple of years using UI5 Tooling, it only annoys me to have to type out the index file and I have never had any use for the directory index page.
If open to the change, this might be a good one for #506☺️
[ui5-middleware-index](https://github.com/ui5-community/ui5-ecosystem-showcase/tree/main/packages/ui5-middleware-index)is a great workaround, but I created this issue to learn about or challenge the usefulness of the default directory listing , whereas it's commonly expected to serve index.html by default when requesting a directory such as /or webapp/.
We saw value in having a directory listing so we added it to ui5-server. We discussed adding an exception for index.* files but never went through with it. Then we added the --open CLI option which allowed you to put things like ui5 serve --open index.html into your package.json. This solved the immediate need for adapting the index listing middleware for us. Later, the community middleware was created and basically no one requested this anymore.
But I see where you are coming from since it indeed seems to be common practice for many web servers.
I think adding a ui5.yaml configuration is simple enough. The serveIndex middleware could then redirect requests for directories which contain one or more files matching with a ranked list of "index" files. Redirecting requests (i.e. "HTTP303 See Other") might be better imho, to make sure developers are always working with the full resource-URL (including the resource name). E.g. http://localhost:8080/ gets redirected to http://localhost:8080/index.html instead of serving the file directly.
We must not forget that ui5-server is a development server. We can't assume how the deployment server works. So we should not add too much magic 🪄
What do you think? Would a project configuration be helpful here or do you see a need to change the default behavior (too)?
Personally, I don't see any value in the directory listing.
I know ui5 serve is only for development purposes, but still, it would be nice to remove the explicit index.html resource request or a community middleware. It simplifies things...
I would change the default behavior as this will not impact bookmarks, CI or --open.
P.S. - On production: @sap/approuter does automatically serve index.html on request to a directory.
I came across this after so many years considering if this should be an issue or not. Considering I host my UI5 on AWS S3 and serve it via AWS CloudFront, I think forcing the /index.html on development environment is quite distracting. If I was to serve this via Apache's httpd, I would also define a DirectoryIndex (which is irrelevant since it's already defined).
I'm confused on how much effort and discussion we should have on this, but on production I definitely don't serve the /index.html on my URLs, so I'd opt to not have it on my dev environment either.
I will try the middleware at the moment, but considering it's a community thing, I'm afraid it could get outdated/out-of-sync eventually. I hope not and I will keep track of it (and try to support).
In any case, thanks for the openness on the discussion and keeping this topic open for so long!
@henriquemattos thank you for your feedback. We were also discussing this topic some weeks ago and have decided to put it on the agenda for #976 (ui5-server: Rethink directory serving). One idea is that with v5 we would enable serving index files by default, and add an option to suppress this behaviour, in case someone wants to browse all directories.
Activity
RandomByte commentedon May 25, 2022
Looks like a duplicate of #579?
piejanssens commentedon May 25, 2022
[ui5-middleware-index](https://github.com/ui5-community/ui5-ecosystem-showcase/tree/main/packages/ui5-middleware-index)is a great workaround, but I created this issue to learn about or challenge the usefulness of the default directory listing , whereas it's commonly expected to serveindex.htmlby default when requesting a directory such as/orwebapp/.indexusing default ìndex.html`RandomByte commentedon May 27, 2022
We saw value in having a directory listing so we added it to ui5-server. We discussed adding an exception for index.* files but never went through with it. Then we added the
--openCLI option which allowed you to put things likeui5 serve --open index.htmlinto your package.json. This solved the immediate need for adapting the index listing middleware for us. Later, the community middleware was created and basically no one requested this anymore.But I see where you are coming from since it indeed seems to be common practice for many web servers.
I think adding a
ui5.yamlconfiguration is simple enough. TheserveIndexmiddleware could then redirect requests for directories which contain one or more files matching with a ranked list of "index" files. Redirecting requests (i.e. "HTTP303 See Other") might be better imho, to make sure developers are always working with the full resource-URL (including the resource name). E.g.http://localhost:8080/gets redirected tohttp://localhost:8080/index.htmlinstead of serving the file directly.We must not forget that ui5-server is a development server. We can't assume how the deployment server works. So we should not add too much magic 🪄
What do you think? Would a project configuration be helpful here or do you see a need to change the default behavior (too)?
piejanssens commentedon May 27, 2022
Personally, I don't see any value in the directory listing.
I know
ui5 serveis only for development purposes, but still, it would be nice to remove the explicitindex.htmlresource request or a community middleware. It simplifies things...I would change the default behavior as this will not impact bookmarks, CI or
--open.P.S. - On production:
@sap/approuterdoes automatically serveindex.htmlon request to a directory.vobu commentedon May 30, 2022
https://github.com/ui5-community/ui5-ecosystem-showcase/tree/main/packages/ui5-middleware-index 😼
henriquemattos commentedon Aug 2, 2025
I came across this after so many years considering if this should be an issue or not. Considering I host my UI5 on AWS S3 and serve it via AWS CloudFront, I think forcing the
/index.htmlon development environment is quite distracting. If I was to serve this via Apache'shttpd, I would also define aDirectoryIndex(which is irrelevant since it's already defined).I'm confused on how much effort and discussion we should have on this, but on production I definitely don't serve the
/index.htmlon my URLs, so I'd opt to not have it on my dev environment either.I will try the middleware at the moment, but considering it's a community thing, I'm afraid it could get outdated/out-of-sync eventually. I hope not and I will keep track of it (and try to support).
In any case, thanks for the openness on the discussion and keeping this topic open for so long!
Cheers,
Henrique
matz3 commentedon Aug 4, 2025
@henriquemattos thank you for your feedback. We were also discussing this topic some weeks ago and have decided to put it on the agenda for #976 (
ui5-server: Rethink directory serving). One idea is that with v5 we would enable serving index files by default, and add an option to suppress this behaviour, in case someone wants to browse all directories.