fpWebFile and session/cookie lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- Trenatos · 2020-05-12 23:20 I'm trying to figure out how to use fpWebFile to serve static content, while also limiting access. I have /app and /app/members, serving files is easy with fpWebFile but I can't figure out how to run a handler for every request to /app/members/* to check if the user is authenticated and either allow access or return a 401. Is there a way to do this with static file/fpWebFile, so I don't have to deal with the entire request manually? IE. mimetypes, checking path, loading the file into content, etc. ---------------------------------------------------------------------- Leledumbo · 2020-05-13 22:29 You can make your own TFPCustomFileModule descendant that overrides HandleRequest (check the authentication etc. here and call the inherited HandleRequest to actually respond with the file content) then assign it to DefaultFileModuleClass. ---------------------------------------------------------------------- Trenatos · 2020-05-15 20:37 That's an interesting idea, I think I'll give that a go, thanks Leledumbo ---------------------------------------------------------------------- Thaddy · 2020-05-15 20:46 static files only need to be readonly, but when further access rights are required leledumbo's suggestion is very good.