-
Notifications
You must be signed in to change notification settings - Fork 20
Getting the community scope #22
Comments
I can take a stab at it. Are you envisioning this code running before every controller? |
#21 is blocking this |
Most. There'll be some "neutral" pages, such as authentication, administration and community management (add, edit, remove), though. |
That should be possible. I'll make a base controller class that performs the URL parsing you describe. Controllers that don't want that functionality just don't inherit from that base class.
I'm not sure why that's the case. The way I'm reading it is that this issue relates to only community data and that issue is concerned with user auth. Am I missing something? |
I misread the issue at hand. |
If my understanding is correct, then the consensus was to use subdomains. This would require a bit more configuration that is currently documented in IIS Express (that is the server thingy that Visual Studio uses) only binds to e.g. I've tried to come up with something myself, and found this stack overflow answer which seemed promising, but didn't work for me. Does anyone know how to configure this on Windows? I've managed to set this up on Linux as follows:
|
My recommendation (I think I made it clear in the forum) is that the Codidact software should support both methods, while the Codidact primary instance should (normally, see exception) use subdomains:
The code should care very little about this. It effectively becomes a "filter" of sorts on input and output - like Apache RewriteRule, except managed to a certain degree (I know it can be done, just not exactly how) within the software. |
Do we really need to implement anything at the application level to manage this? AFAIK it's usually done at the server level (URL Rewrite in Apache, IIS or whatever else). It wasn't long ago that I refactored out some old URL rewriting code from a legacy .NET web application and ported all rules to IIS instead. Worked just as well, if not better. Very nice to maintain and everyone was happy. |
The rewriting should only happen if some configuration option is turned on. If we put this option into the server configuration, it might be necessary to get that information in the application too for e.g. redirects. This would mean redundancy or some common configuration file which seems difficult. I am also unsure how much the server configuration has to offer, there is also a URL Rewriting Middleware in ASP.NET integrated, but it's not powerful enough to do this rewriting (at least to my knowledge). |
Is this requirement specified somewhere? I must have missed it (and, in principle, don't agree with).
In terms of KISS, I very much doubt it will be more difficult than implementing and specially maintaining the middleware in the long term.
A lot! More than enough for the current needs (that I'm aware of). I maintain that the server configuration is the right place to do this. When there is a requirement for localizing URLs, a middleware might be considered for that specific purpose. |
There was some discussion here, and some stuff further down the thread, leading to this post. The big plus is that we can use subdomains on https://codidact.com while allowing other instances to use the path schema.
I've never done rewriting in a server configuration, maybe one simple regex but nothing more. Maybe someone could provide an example of how this could be done. I got the suspicion that this results in one mega regex that is completely unreadable. |
Got it, ty. Let me follow up on those and come back later to comment. :) |
@ranolfi I changed my position on this topic. Don't get me wrong, on the long term doing it with configuration options in C# would is preferable in my opinion, however, we are creating a minimum viable product, thus simpler is better. I've come up with the following configuration for Nginx:
I am sure something similar can be done in IIS too, but I think someone with Windows knowledge should address that. This can also be done at a later date, because we'd use the path schema during development anyway. I'll close #23 and salvage some of the configuration stuff in a separate pull request, unless anyone objects. |
I edited the configuration to use encryption and added the redirect:
|
For anyone that wants to actually do it here is what you need to do: ! PSUEDO CODE WARNING !
Add the global filter if appropriate:
|
I think we need to have this before being able to work on posts and users:
https://github.com/codidact/core/projects/1#card-31579420
A system, which parses the URL, gets the community ID from it, verifies, whether that is in the DB and if it is, loads some information (name, tagline) into memory and passes that to the further controllers and views.
I'd do it, but I don't have enough knowledge in ASP.NET Core, so I'd like to ask for volunteers doing it. :)
Please reply here, when you can do this and I'll assign this task to you.
The text was updated successfully, but these errors were encountered: