Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[IMPORTANT] [BUG] indexHTML option is broken in latest version #37

Open
touhidurrr opened this issue Oct 10, 2024 · 0 comments · May be fixed by #38
Open

[IMPORTANT] [BUG] indexHTML option is broken in latest version #37

touhidurrr opened this issue Oct 10, 2024 · 0 comments · May be fixed by #38

Comments

@touhidurrr
Copy link

touhidurrr commented Oct 10, 2024

Important

This bug only appears when NODE_ENV=production

Folder structure

| - public
  | - index.html
  | - test
    | - index.html
| - test.ts

Files

index.html -> fill in with any generic HTML content.

// test.ts
import { Elysia } from 'elysia';
import { staticPlugin } from '@elysiajs/static';

const port = 8080;
const hostname = '0.0.0.0';

const app = new Elysia()
  .use(staticPlugin({ prefix: '/', indexHTML: true }))
  .listen({ port, hostname });

console.log(`Server started at ${app.server?.url}`);

Note

indexHTML is true by default, but I set it to true explicitly anyways

Versions

  1. Bun -> 1.1.31
  2. elysia -> 1.1.20
  3. @elysiajs/static -> 1.1.1

Tests

  1. GET http://localhost:8080/ -> (redirect) http://localhost:8080 -> NOT_FOUND
  2. GET http://localhost:8080 -> NOT_FOUND
  3. GET http://localhost:8080/test -> NOT_FOUND
  4. GET http://localhost:8080/test/ -> NOT_FOUND
  5. GET http://localhost:8080/index.html -> Works
  6. GET http://localhost:8080/test/index.html -> Works

Conclusion

indexHTML option in all broken in all shape and form is the latest version. After some testing, the last working version is 1.0.3.

@touhidurrr touhidurrr changed the title [IMPORTANT] [BUG] indexHTML option is broken static plugin latest version [IMPORTANT] [BUG] indexHTML option is broken in latest version Oct 10, 2024
touhidurrr added a commit to touhidurrr/elysia-static that referenced this issue Oct 11, 2024
@touhidurrr touhidurrr linked a pull request Oct 11, 2024 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant