-
Couldn't load subscription status.
- Fork 1.9k
apache: set the remote ip from X-Real-IP by default #297
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
Conversation
|
Could someone please confirm the travis error: The command "bash -c "[[ $hash_before = $(git add -A && git write-tree) ]]"" exited with 1. Skipping the after_script stage due to the configuration. is related to my change? I'm happy to dig further to figure it out. Just checking that I'm not chasing a gost ;-) |
|
For the record, I have manually tested the changes with
|
|
This file is generated by script. Nice to see you contribute here, I've been following your work on ceph. |
Oh, thanks for the hint, will do!
Thank you for the kind words, makes me feel very welcome :-) |
|
the 2 commits, can be in the same PR, it just ease the reviewing to separate them. |
|
@pierreozoux Ok, will do, thanks for the advice :-D |
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 to me!
|
All pass except https://travis-ci.org/nextcloud/docker/jobs/360574391 because travis has trouble reaching the keyserver. Should I force-repush to trigger another build? It looks like that kind of transient error is fairly common so maybe you prefer to force-merge instead of wasting additional CI runs? I'm happy either way, just let me know ;-) gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A gpg: keybox '/tmp/tmp.AEdOLd/pubring.kbx' created gpg: keyserver receive failed: Address not available |
|
One last question, in nginx, you have to tell from whom to trust who can set this header, here in apache, there is no such mechanism? It will just trust everybody including me? |
There is but I misread the documentation and incorrectly concluded it would only allow internal IPs by default. Fixing that, thanks for catching this mistake! |
|
Added the suggested internal IP ranges and manually tested they work as expected on a live instance. RemoteIPHeader X-Real-IP RemoteIPTrustedProxy 10.0.0.0/8 RemoteIPTrustedProxy 172.16.0.0/12 RemoteIPTrustedProxy 192.168.0.0/16 |
W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages Hash Sum mismatch transient error apparently. I won't repush since it seems more effective for someone with access to re-start the failed jobs instead. |
13.0/apache/Dockerfile
Outdated
|
|
||
| RUN a2enmod rewrite | ||
| RUN a2enmod remoteip | ||
| RUN { echo RemoteIPHeader X-Real-IP ; echo RemoteIPTrustedProxy 10.0.0.0/8 ; echo RemoteIPTrustedProxy 172.16.0.0/12 ; echo RemoteIPTrustedProxy 192.168.0.0/16 ; } > /etc/apache2/conf-enabled/remoteip.conf; chown www-data:root /etc/apache2/conf-enabled/remoteip.conf |
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.
please reduce the number of layer by merging these three run statements into one
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.
Good idea, will do!
|
@dachary i removed the |
|
@tilosp modified and repushed, thanks for your review :-) |
11.0/apache/Dockerfile
Outdated
| VOLUME /var/www/html | ||
|
|
||
| RUN a2enmod rewrite | ||
| RUN a2enmod rewrite remoteip ; { echo RemoteIPHeader X-Real-IP ; echo RemoteIPTrustedProxy 10.0.0.0/8 ; echo RemoteIPTrustedProxy 172.16.0.0/12 ; echo RemoteIPTrustedProxy 192.168.0.0/16 ; } > /etc/apache2/conf-enabled/remoteip.conf; chown www-data:root /etc/apache2/conf-enabled/remoteip.conf |
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.
having the entire run statement in one line makes it difficult to read.
It would look a lot nicer if you formated it similar to the run statement above that sets the recommended PHP.ini settings
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.
take a look at https://github.com/docker-library/php/blob/c4f059d09d7eefcb73304d198faa7674610ed810/apache-Dockerfile-block-1#L43
the config file is placed under conf-available and than a2enconf is run to enable it. This makes sense because than you can simply run a2disconf to disable it if you don't want to use it.
And by the way the chmod is unessesary all the other config file are simply owned by root
|
@tilosp thanks for the detailed instructions, it makes it super easy for me :-) Amended and repushed ! |
|
Thanks both of you for the nice work! |
|
@pierreozoux silly question: when and how is this going to show in the docker hub? |
|
I think the docker bot runs once a day. |
Relates to: #294