Using Prodigy with a ProxyPass

solved
install
(Ellen Cramer) #1

Greetings, I installed Prodigy on my VM (ubuntu 16.04) this week. I was able to get Prodigy working on port 8000 successfully with the examples.

I work with a small distributed team and want to put prodigy behind a login so they can see it. I decided to use apache2 ProxyPass to hide the prodigy service on localhost:8000. I have the login working (htpasswd) on apache2 and can get the ProxyPass to work, but only partially for Prodigy. Meaning, I see the Prodigy interface, but there’s no project and gets an error.
“ERROR: Can’t fetch project. Make sure the server is working correctly.”

As mentioned above, the same service works fine if I access it via port 8000 directly (firewall temporarily open) and a simple python http.server 8000 works with the ProxyPass settings on 8000 with no issues.

prodigy.json
{
“host”: “0.0.0.0”, (did not work with localhost)
“port”: 8000,
}

Apache2 virtualhost settings:
ProxyPreserveHost Off (and tried on)
ProxyRequests Off (and tried on)
ProxyPass “/prodigy” “http://localhost:8000/
ProxyPassReverse “/prodigy” “http://localhost:8000/

Other permutations tried in vh conf:
– outside of and inside of Location
– with localhost and 0.0.0.0 permutations with host in prodigy.json
– with and without trailing slash on directory or url

Is there some reason it doesn’t work with the Prodigy server that is not obvious to me?

Does anyone have any advice on this setup or other suggestions on the best practice for hiding/protecting the service?

Thank you! elly

0 Likes

(Matthew Honnibal) #2

:cold_sweat:

Some of the most frustrating hours I’ve spent have been trying to rig this sort of thing up with Apache or nginx :(. It always should be simple, but somehow it always takes me ages to get it right.

I’ve been finding Traefik a bit easier to configure: https://traefik.io/ , although it does have its own quirks. Apache absolutely should work though – it’s just that I can’t see where you’re going wrong either.

0 Likes

(Matthew Honnibal) #3

If you do go with Traefik, here’s how the routes.toml should look:

[frontends]
  [frontends.frontend1]
  backend = "backend1"
  [frontends.frontend1.routes.r1]
  rule = "Host:0.0.0.0"

[backends]
  [backends.backend1]
    [backends.backend1.servers.server1]
    url = "http://127.0.0.1:8000"

One of the things I like about traefik is it’s a go program, so you get it in a nice single statically linked binary. You can just download the binary and run traefik --file --file.filename=routes.toml

Once you get it working, you’ll want to run it with systemd to keep the server running. Here’s how the service file would look:

[Unit]
Description=The Traefik HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
ExecStart=/usr/bin/traefik --file --file.filename=/etc/traefik/routes.toml

[Install]
WantedBy=multi-user.target
0 Likes

(Ellen Cramer) #4

Thanks Matt! I’ll give Traefik a try and let you know. I do appreciate your sympathetic and helpful response. To be continued…

0 Likes

(Ellen Cramer) #5

Hi Matt,

Just a follow up to my issue… I didn’t end up using Traefik, I figured out how to get this to work using the apache virtualhost ProxyPass settings by adding entries for /projects, /get_questions, /fonts. I am using a subdirectory for the ProxyPass so I can put it behind a login and keep my apache for other purposes. But Prodigy was looking for /projects, etc on the top level and not under /annotations/projects. It was initially finding /annotations/bundle.js ok, hence why I had some interface showing but no projects or questions. I suppose I could do it with a one line mod_rewrite as well.

I think it’s ok otherwise, fingers crossed.

If you see any problem with this, please let me know. Thanks!

<virtualhost *:443>
    ProxyPreserveHost Off
    ProxyRequests Off

    <Location "/annotations/">
       Order allow,deny
       Allow from all
       AuthType Basic
       AuthName "Restricted Content"
       AuthUserFile /etc/apache2/.htpasswd
       Require valid-user
       ProxyPass "http://localhost:8080"
       ProxyPassReverse "http://localhost:8080"
    </Location>

    ProxyPass "/project" "http://localhost:8080/project"
    ProxyPassReverse "/project" "http://localhost:8080/project"
    ProxyPass "/get_questions" "http://localhost:8080/get_questions"
    ProxyPassReverse "/get_questions" "http://localhost:8080/get_questions"
1 Like

(Ellen Cramer) #6

Update: Turns out we missed the “/give_answers” url, which was the one Prodigy was using to write back to the server.

ProxyPassReverse "/give_answers" "http://localhost:8080/get_questions"
0 Likes

terms.teach: OverflowError: Python int too large to convert to SQLite INTEGER
(Matthew Honnibal) #7

Thanks for updating! Glad you were able to get it to work.

0 Likes