Skip to content

Bug in Saturn to Giraffe guide #362

@jwthomson

Description

@jwthomson

Someone on the F# discord mentioned that the guide for switching from Saturn to Giraffe did not work for them.

Repro steps:

  1. Create SAFE app
  2. Follow the guide (https://safe-stack.github.io/docs/recipes/client-server/saturn-to-giraffe/)
  3. Run the bundled version of the app:
    dotnet run Bundle
    cd deploy
    Server.exe

Expectation:
Hit localhost:5000 in your browser and see the default todo app.

Actual result:
Hit localhost:5000 in your browser and get a 404 error.

The fact that the application does work in dev mode dotnet run but fails once bundled - indicates to me that there is an an inconsistency with the way Vite handles incoming requests vs how Kestrel/IIS handles incoming requests.

I think the difference in behaviour is due to Kestrel is not remapping root requests to index.html by default. In contrast, Vite defaults to serving index.html for root requests. (and this seems to be non-negotiable! https://vitejs.dev/guide/#index-html-and-project-root)

For me, the workaround posted in Discord - renaming the public folder to wwwroot - did not work.

Working on a PR to fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions