Skip to content

Why does UI5 tooling serve a directory index? #623

Description

@piejanssens

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 ☺️

Activity

  1. RandomByte commented on May 25, 2022

    @RandomByte
    Member

    Looks like a duplicate of #579?

  2. piejanssens commented on May 25, 2022

    @piejanssens
    Author

    [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/.

  3. RandomByte commented on May 27, 2022

    @RandomByte
    Member

    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)?

  4. piejanssens commented on May 27, 2022

    @piejanssens
    Author

    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.

  5. vobu commented on May 30, 2022

    @vobu
  6. self-assigned this
    on Jul 16, 2025
  7. added this to the UI5 Tooling v5 milestone on Jul 16, 2025
  8. henriquemattos commented on Aug 2, 2025

    @henriquemattos
    Contributor

    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!

    Cheers,
    Henrique

  9. matz3 commented on Aug 4, 2025

    @matz3
    Member

    @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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions