Comments (9)
Btw: so just that you are aware and to link it: #83
request.remote_addr was removed and changed to request.get_remote_address
So if my second statement is incorrect and you do need to append it another time, pls swap it
from matrix-registration.
Sry for not responding earlier - didn't see it.
Is this testet / merge ready?
If you think it should work, please open a pull request so we can sort it out!
from matrix-registration.
Depends if you think the change is acceptable -- it would switch from storing a single IP to a list of IPs, which may or may not be something people want. (If that approach is acceptable, I'm happy to submit a PR.)
from matrix-registration.
First of all, I think it a good change. As long as it stays a single string so we dont have to alter the database structure.
Regarding your code (correct me if im wrong, because im not that fluent with flask and shit)
- the code in the readme is the one for the nginx reverse proxy so $remote_addr should be the clients address? (as long as its the only layer of proxy -> cloudflare, matrix-docker-ansible project), but many ppl use systems with multipls layers of reverse proxys so it'd be still good
- the nginx website claims that the $proxy_add_x_forwarded_for appends the current $remote_addr to the incoming X-Forwarded-For header, so using the header in your phython should be enough and you shouldn't need to append request.remote_addr again
- have you testet that it still works with the old nginx config (backwards comp) and without a reverse proxy?
from matrix-registration.
OK, I can work it up as a PR, maybe even with unit tests. :-) I'm not particularly familiar with Flask either.
I can also try testing it manually with different configurations.
from matrix-registration.
What I just noticed reading this again:
Could it have been that we've been ratelimiting the request from the proxy itself (if present) so for all users (maybe @SapuSeven knows), and whether integrating the header change in the limiter would be possible
from matrix-registration.
@timmc can you open the pr as draft now so we can move the discussion there? (Just your current code is fine then we can also suggest changes directly within githubs code thing)
from matrix-registration.
What I just noticed reading this again: Could it have been that we've been ratelimiting the request from the proxy itself (if present) so for all users (maybe @SapuSeven knows), and whether integrating the header change in the limiter would be possible
I have to say that I don't really know how exactly rate limiting works, I just looked at the code changes of the remote repository and noticed that get_ipaddr
seems to have been replaced with get_remote_address
.
Sorry for not testing this properly.
from matrix-registration.
Alternatively, solve both issues by adding a config setting like CLIENT_IP_HEADER = [X-Forwarded-For | X-Real-IP | etc.]
that instructs the app that there's a trusted proxy in front -- if not set, use request.remote_addr
, and if set, use request.headers.getlist(config.CLIENT_IP_HEADER)[-1]
.
from matrix-registration.
Related Issues (20)
- docker healthcheck fails after running for a while
- Errors by exec "matrix-registration"
- home_server field in registration response is deprecated HOT 3
- No such option --config-path HOT 3
- Broken with SQLAlchemy 2+
- synapse's password policy is ignored/circumvented HOT 4
- All Requests Respond with 404 After Upgrade HOT 2
- Add Support for deleting tokens from the database via API HOT 1
- Not compatible with flask-limiter >= 2.0.1, but `setup.py` will cause it to be installed anyways HOT 4
- Are you still updating the docker images? HOT 2
- Generated token is not recognized HOT 2
- API does not working? HOT 5
- OSError: [Errno 99] Cannot assign requested address HOT 7
- arm64 docker image HOT 1
- Can't access registration page on port 5000 HOT 8
- install error on Ubuntu 22.04 HOT 2
- How to change Website language? HOT 1
- 404 Error ehwn i try to connect matrix-registration on port 5000 HOT 5
- Is this project dead? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from matrix-registration.