-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Serve static files after validating cookies on request in http_callback #3302
Comments
Hi @lws-team, I had continued my analysis and learnt that LWS_CALLBACK_FILTER_HTTP_CONNECTION event received for all the requests including for static files. So, I set the mount.origin_protocol=LWSMPRO_FILE and handled cookie validation at LWS_CALLBACK_FILTER_HTTP_CONNECTION and proceed with the existing flow as mentioned below.
Is this a good approach or any better option is available? Please provide your suggestions. Thanks, |
Hi Andy, I had used the above logic to handle cookie validation. Scenario: Working callback flow: Non working callback flow: I also have couple of observations:
I tried returning 1 from LWS_CALLBACK_FILTER_HTTP_CONNECTION , still the behavior is same. Thanks, |
Hi Andy,
lws_http_mount.origin_protocol=LWSMPRO_FILE protocol is designed such a way that the static files get served automatically without hitting the http_callback.
If lws_http_mount.origin_protocol is set to LWSMPRO_CALLBACK, all the requests will hit the http_callback and files to be served using lws_serve_http_file(). For this lws_http_mount.origin is not considered, so path needs to be set properly before calling lws_serve_http_file().
Based on above understanding, I would like to get your inputs on the following.
Sample Code of server:
The text was updated successfully, but these errors were encountered: