Skip to content

Doc: fixing Apache websocket example #3174

Merged
tardyp merged 2 commits intobuildbot:masterfrom
gracinet:0.9-fix-apache-doc-websocket
May 11, 2017
Merged

Doc: fixing Apache websocket example #3174
tardyp merged 2 commits intobuildbot:masterfrom
gracinet:0.9-fix-apache-doc-websocket

Conversation

@gracinet
Copy link
Copy Markdown

@gracinet gracinet commented May 4, 2017

Hello,
after upgrading one of my masters to Debian 9 (Stretch) I found the Apache configuration to be broken, here's an updated working one.

Regards

Georges Racinet added 2 commits May 4, 2017 13:26
The configuration example simply did not work for 2.4.25 on Debian 9
(if I remember correctly, I am the author of that example): it gave a
403 Forbidden response on the /ws URI, with nothing showing up in
Apache or Buildbot logs.

Using a separate location to dispatch ProxyPass directives is a method
that I have carried out for so long I don't even remember if I
originally got it from someone else's samples or not. A fresh look at
mod_proxy documentation indicates that the ProxyPass directives are
evaluated as "first match wins"

My best guess is that the order of precedence between Location and
ProxyPass ! directives must have changed a bit between 2.4.10 and 2.4.25,
hence the latter gives the 403 before the <Location /ws> is evaluated.

The new provided example is both simpler and working in all cases.
This additional comment is rather obvious, but explicit is better
than implicit.
@mention-bot
Copy link
Copy Markdown

@gracinet, thanks for your PR! By analyzing the history of the files in this pull request, we identified @tardyp, @sa2ajj and @benallard to be potential reviewers.

@codecov
Copy link
Copy Markdown

codecov bot commented May 4, 2017

Codecov Report

Merging #3174 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3174   +/-   ##
=======================================
  Coverage   88.05%   88.05%           
=======================================
  Files         317      317           
  Lines       33146    33146           
=======================================
  Hits        29187    29187           
  Misses       3959     3959

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c70cd12...b7b9e94. Read the comment docs.


ProxyPass /ws !
# replace with actual port of your Buildbot master
ProxyPass ws://127.0.0.1:8020/ws
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you verify it worked on 2.4.10, or this is just with 2.4.25?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tardyp, yes I am using it currently with both versions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gracinet at least it doesn't work with httpd-2.4.6-45.el7.centos.4.x86_64

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Frodox thanks for the feedback. I don't have a buildmaster on-hand on CentOS 7. Does the previous version work in that context ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gracinet yes. take a look #3299 (and docs) :D
Could you post there your full config for bb-master? it is strange for me it works

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Frodox, sure here it is

<VirtualHost *:443>
        ServerName bb9.example
        ServerAdmin webmaster@bb9.example
        <Location />
          AuthType Basic
          AuthBasicProvider ldap 
          AuthName "Please login"
          AuthLDAPUrl "ldaps://ldap1.example ldap2.example/dc=example?uid?sub?(objectClass=*)" NONE

          AuthLDAPBindDN cn=apache,dc=example
          AuthLDAPBindPassword SECRET

          Require valid-user

          RewriteEngine On
          RewriteCond %{LA-U:REMOTE_USER} (.+)$
          RewriteRule . - [E=RU:%1,NS]
          RequestHeader set REMOTE_USER %{RU}e
        </Location>

        ProxyPass /ws ws://localhost:8011/ws
        ProxyPassReverse /ws ws://localhost:8011/ws
        ProxyPass / http://localhost:8011/
        ProxyPassReverse / http://localhost:8011/

        SetEnvIf X-Url-Scheme https HTTPS=1
        ProxyPreserveHost On


       SSLEngine on
       # more SSL stuff

</VirtualHost>

As you can see, I'm doing basic auth on LDAP (don't think it should interfere too much).

This is a Debian 8 system, with the standard current apache2 package, and the default MPM config.

$ apt-cache policy apache2
apache2:
  Installed: 2.4.10-10+deb8u8
  Candidate: 2.4.10-10+deb8u8
  Version table:
 *** 2.4.10-10+deb8u8 0
        500 http://ftp.debian.org/debian/ jessie/main amd64 Packages
        500 http://security.debian.org/ jessie/updates/main amd64 Packages
        100 /var/lib/dpkg/status

As you may know, Debian's configuration is split in several files. I don't have anything special besides the virtualhost. Notably, /etc/apache2/mods-enabled/proxy.conf is the stock one.

A side effect is always possible, but it doesn't seem very likely.

Hope this helps.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gracinet hey, are you kidding me? :D Well, you use

ProxyPass /ws ws://localhost:8011/ws
ProxyPassReverse /ws ws://localhost:8011/ws

which is same as

<Location /ws>
         ProxyPass ws://127.0.0.1:8011/ws
         ProxyPassReverse ws://127.0.0.1:8011/ws
</Location>

but without <Location /ws>, or without ProxyPass /ws it would be broken. So, in PR you just remove Location but didn't add /ws, which you are using actually :) So, original config in docs was correct.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gosh you're right, seems I made a copy-paste error while contributing to the doc, and my eyes siliently corrected the line each time I reread it (including this morning).

That being said, no the previous version doesn't work on 2.4.25, and that's because of the ProxyPass /ws !

For the record, my configurations on Debian 9 and 8 are managed by configuration manager, using the same template.

Anyway, yes, the /ws is missing and the simplest is to add it, alongside with the info that it also works on CentOS version.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and we should stop discussing on this closed PR, switch to #3299

@tardyp
Copy link
Copy Markdown
Member

tardyp commented May 11, 2017

@gracinet thanks for confirmation

@tardyp tardyp merged commit 845b7b9 into buildbot:master May 11, 2017
@gracinet
Copy link
Copy Markdown
Author

Thanks !

@gracinet gracinet deleted the 0.9-fix-apache-doc-websocket branch May 11, 2017 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants