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

How to apply filters on static files? #23

Open
StefanLiebig opened this issue Sep 8, 2017 · 2 comments
Open

How to apply filters on static files? #23

StefanLiebig opened this issue Sep 8, 2017 · 2 comments

Comments

@StefanLiebig
Copy link

StefanLiebig commented Sep 8, 2017

It seems that static content
staticFiles.location("/public")
will not be matched by filters:
before("/*") { req, res -> .... }

I need to do authentication/authorization in a filter.

Is the pattern wrong?
How can I achieve this?

(using spark 2.6.0)

@StefanLiebig
Copy link
Author

I found this advice https://stackoverflow.com/questions/38154744/add-before-filter-for-static-files-in-sparkjava which works but has the downside that every request to static resources is leads to an error log in MatcherFilter: The requested route ... has not been mapped in Spark for ...

@perwendel
Copy link
Owner

Static files are served before the filters so currently there's no way of doing this (if using the static files functionality provided by the framework)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants