Closed darcydriscoll closed 2 years ago
Having trouble with Apache server configuration:
Maybe I could play around with the rewriting conditions and see what I find.
Having trouble with Apache server configuration:
When I set RewriteBase to "/", Apache doesn't start. Why?
When I don't include RewriteBase, Apache starts. But pages don't load correctly. By the errors I'm getting, it seems that whenever the client tries to get the relevant JS files from the server, the server returns a file that starts with '<' instead. This is probably a .html file, and likely 'index.html'. Are the rewriting conditions too broad?
Maybe I could play around with the rewriting conditions and see what I find.
Causes for both of these issues:
RewriteBase
isn't necessary to use outside of a per-directory or .htaccess
context. I wasn't using it in either of those contexts, and because of that, it seems that Apache self-destructed.RewriteCond
statements. They each referenced the variable REQUEST_FILENAME
. Ideally, REQUEST_FILENAME
returns the full (absolute) filesystem path to the file. But they weren't in this case for some reason -- they were pointing to the path component of the requested URI (e.g. '/index.html
'). RewriteCond
in a server config context starts at the server's root directory. This meant that the RewriteCond
conditions were always passing, because something like '/chunk_vendors.js
' didn't exist in the server's root directory. One solution is to reference the variable LA-U:REQUEST_FILENAME
. This is a lookahead variable that determines the final, 'ideal' value of REQUEST_FILENAME
. The other solution is to do the rewriting in a per-directory (<Directory 'path'></Directory>
) or .htaccess
context.
REQUEST_FILENAME
return the absolute path to the file? According to the mod_rewrite
docs, it looks like my RewriteCond
statement was in a 'per-server' context, which occurs before the HTTP request is mapped to the filesystem. I think this means that it's at the root level of the httpd.conf
file.Doesn't look like any other server configuration needs to be done.
Currently, we push the user to /index.html
when they get a URL that doesn't physically exist (e.g. /chatroom
, or a random string of characters). But: the URI that the user sees stays the same, and vue-router uses that URI, not the page the user is pushed to! So, as long as we get things right logically, we're good.
This does mean we have to get things right logically though. So I'll add that to the to-do list.
Added a fade-in transition for the sign-in page. I won't be adding any more in this story, because I don't know how I want the app to fade between the sign-in page and the chat room page yet.
I extended the session lifetime to 72 hours. This lets users keep their nicknames around for longer without allowing trolls to hog nicknames for too long.
Working on simple PHP error handling and propagation to client. Some things to look into:
Whoops!
I've implemented rudimentary error handling such that most errors are propagated down to the client. Some things to refactor:
Working on standardising error codes. I've got it working on the server-side, now I'm working on the client-side.
It's more complex than I thought it would be. I guess I've never done this combination of array manipulation and file handling before. They're not areas that I'm especially competent in.
I've put some work into client-side error codes. Again, harder than I thought.
I need a way to prevent the SignIn component from doing anything before we've fetched the error codes and processed them. We could use .then
and a data property to record when everything is loaded? Then, use that data property on the template to turn on/animate/brighten the sign in component when it hits true
.
Or -- can we make use of await in Vue lifecycle methods? Anything else in Vue -- async components? <Suspense>
?
Done! Added attributions as well.
Requirements
Notes
Remaining criteria as of 14/02/2022
vue-router
level when they try to get logical pages that don't exist.file_get_contents
withjson_decode
. Put the file into a string and then transform it into an array.