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?
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.
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
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"