Closed d30jeff closed 7 years ago
The error is telling you correctly, because it shouldn't show $lwsgs_user
in the main window. This should get rewritten.
At the mountpoint config where you place this, you need some "interpret" args like this
{
# things in here can always be served
"mountpoint": "/lwsgs",
"origin": "file://_lws_ddir_/libwebsockets-test-server/generic-sessions",
"origin": "callback://protocol-lws-messageboard",
"default": "index.html",
"auth-mask": "0",
"interpret": {
".js": "protocol-lws-messageboard"
}
}, {
# things in here can only be served if logged in as a user
"mountpoint": "/lwsgs/needauth",
"origin": "file://_lws_ddir_/libwebsockets-test-server/generic-sessions/needauth",
"origin": "callback://protocol-lws-messageboard",
"auth-mask": "1", # b0 = logged in with any user name
"interpret": {
".js": "protocol-lws-messageboard"
}
}, {
# things in here can only be served if logged in as admin
"mountpoint": "/lwsgs/needadmin",
"origin": "file://_lws_ddir_/libwebsockets-test-server/generic-sessions/needadmin",
"origin": "callback://protocol-lws-messageboard",
"auth-mask": "3", # b1 = admin, b0 = logged in with any user name
"interpret": {
".js": "protocol-lws-messageboard"
}
They cause the content in files matching the suffix to be passed through the given protocol's LWS_CALLBACK_PROCESS_HTML before being served. The messageboard protocol passes it back to the generic-sessions implementation, which replaces these strings
"$lwsgs_user",
"$lwsgs_auth",
"$lwsgs_email"
with the active values from the current session, before passing the buffer back up to be served.
Thanks so much for pointing me to the right direction. I have managed to replicate the demo with the help of the config that you've given.
Thanks a lot.
I've been following this tutorial.
I have a test directory located at
/var/www/testing/
that contain these files:My configuration file is stored at
/etc/lwsws/conf.d/generic
When I head over to
localhost:8080
I get this error saying that lwsws is misconfigured.Thanks