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
middleware: don't use middleware when loading images #429
Conversation
27d4be5
to
268640b
Compare
Actually, I think I have a better answer as soon as I figure out the correct negated regex expression. |
268640b
to
cc649e2
Compare
Maintaining a regex here is not appropriate because it will require changes every time the application routes change, which is going to be very error-prone and non-intuitive for new devs. This can be achieved by simply creating a new sub-router for static files, and don't attach any middleware to that subrouter. I actually implemented this change some time ago, but it seems like it never made it into master. It must be lost on my local machine somewhere, I will try to find it. |
ok! That's what I'm trying to do, but then the regex wouldn't let me do not, and I'm not sure how to specify the folders easily otherwise, yet. |
https://github.com/decred/dcrstakepool/compare/master...jholdstock:routers?expand=1 Found it - see the changes here. I think this achieves the desired result. |
Note that |
thanks, I just needed to change the order and goji does the rest. Ill remove those paths then? |
eeb52ec
to
edf05e7
Compare
-divide html routes into html and static files -don't apply middleware to static files
edf05e7
to
5b43820
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good. Thanks
This is a good improvement. I just noticed dcrdata defines an nginx
|
That's a solution I would encourage, especially since nginx is so effective at handling cached static resources. |
like here ? #433 |
Oh, good stuff. ;) |
I think #433 is missing an opening bracket. |
hey, thanks guyz, quick question. @chappjc @isuldor So with this in the nginx conf:
Should this pr we are commenting on now not be necessary? I can't tell that the above makes any difference. Even adding the bracket after location /assets/* |
Actually, I think I get it now. Thank you! |
* commit 'bbcce9335b3eafca8469796d48e2f2649d17451c': go.mod: update protoc-gen-go to version 3 (decred#436) main.go: get for voting page with no multisig redirects to address (decred#438) emailupdate: emailupdate to same design as passwordupdate (decred#435) server: don't use middleware when loading images (decred#429) Remove duplicated js-only code (decred#439)
-divide html routes into html and static files -don't apply middleware to static files
check url for gets directed at "/assets" and "/captchas" and ignore them
in the middleware
before this change, open home, fmt.Println("ApplyDbMap") in middleware.go func ApplyDbMap
after this change, open home with the same print in the same place
I don't believe middleware should be applied to gets to pics for performance reasons, as they aren't using the information, I don't think