Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

StaticFilter doesn't 404 properly #2935

Closed
wearpants opened this issue May 7, 2024 · 4 comments
Closed

StaticFilter doesn't 404 properly #2935

wearpants opened this issue May 7, 2024 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@wearpants
Copy link

wearpants commented May 7, 2024

Stumbled on this while debugging some reverse proxy issues - StaticFilter will serve the contents of index.html when requested file doesn't exist , instead of returning a 404 response. See these lines:

if strings.Contains(path, "/../") || !util.FileExist(path) {
path = webBuildFolder + "/index.html"

@casbin-bot
Copy link
Contributor

@casbin-bot casbin-bot added the question Further information is requested label May 7, 2024
@hsluoyz
Copy link
Member

hsluoyz commented May 7, 2024

@wearpants what do you mean by "requested file doesn't exist"? What's the scenario?

@wearpants
Copy link
Author

When I request a file that does not exist on disk in the /web/build directory, instead of a 404 response, I get back the contents of index.html

$ curl http://mycasbin.example.com/NONESUCH
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Casdoor - An Identity and Access Management (IAM) / Single-Sign-On (SSO) platform with web UI supporting OAuth 2.0, OIDC, SAML and CAS"/><link rel="apple-touch-icon" href="https://demo.omaha-data.com/casdoor/static/img/favicon.png"/><link rel="manifest" href="https://demo.omaha-data.com/casdoor/static/site/casdoor/manifest.json"/><title>Casdoor</title><script defer="defer" src="./static/js/main.05f504df.js"></script><link href="./static/css/main.b5f23b34.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

@hsluoyz
Copy link
Member

hsluoyz commented May 8, 2024

@wearpants this is expected. As the frontend is a React SPA. You better learn what React is first.

@hsluoyz hsluoyz closed this as completed May 8, 2024
@casdoor casdoor locked and limited conversation to collaborators May 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants