Open LouisKottmann opened 9 years ago
I was having similar trouble using apache as a proxy and redirecting to kandan with the RAILS_RELATIVE_URL_ROOT as above. In my case, the app processed the request, but the URL it returned was "my_site.com/users/sign_in" when it should have been "my_site.com/kandan/users/sign_in". After trying many things on the apache end to fix the URL, I'm left thinking it's a Kandan issue.
@tyleraland I tried so many things, for 2 straight days actually, nothing does it. I tried:
--prefix=/kandan
to thin start
RAILS_RELATIVE_URL_ROOT="/kandan"
map Kandan::Application.config.relative_url_root
before run Rack::URLMap...
in config.ru
run Rack::URLMap...
in config.ru
scope "/kandan"
in routes.rb
config.relative_url_root = "/kandan"
in production.rb
Nothing really worked, I got partial stuff working like the account menu and login/main page with assets loading (need to set config.serve_static_assets = true
in production.rb
).
But Faye never understood to make its POST requests to /kandan/remote/faye
instead of /remote/faye
, I never got the /channels
to get the correct route, and lots of other stuff. This is a nightmare.
Furthermore, there hasn't been any activity since May this year, long holidays?
I've resigned to asking my local network administrator to add a second DNS entry pointing to the existing server, then use it to uniquely identify via ServerName in apache, which seems to work fine (no subdirectories...)
Would love to see this fixed :)
@tyleraland can you explain that procedure in more details? I'm trying to keep SSL on at the same time..
I asked on stackoverflow (here)
With the caveat that I'm still testing/configuring... (and that this is apache, not some sexy ruby app)
I've asked my local network admin to add a second DNS entry, by a different name, pointing to the IP of the apache server. Incoming requests to that server see the URL request and hand it off to the correct virtualhost, identified by ServerName in the virtualhosts block.
In my /etc/apache2/sites-available/kandan:
# Capture all HTTP traffic and rewrite it to use HTTPS
<VirtualHost *:80>
# redirect user to https
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>
# Capture all HTTPS traffic to my_kandan_site.com.
<VirtualHost *:443>
ServerName my_kandan_site.com
# Redirect it to my local kandan app
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
SSLEngine on
SSLCertificateFile /etc/ssl/certs/InCommon.pem
SSLCertificateKeyFile /etc/ssl/private/my_kandan_site.key
Kandan just runs, without special modifications, with "bundle exec thin start"
Have you seen #370 for docker support? I haven't pulled it in yet as I haven't tested it, but that might be a good start. Looks like @tyleraland might have more experience setting this up under the environment you want however.
@scouttyg I don't see how #370 helps me to run kandan at http://mysite.com/kandan
, did I miss something?
@tyleraland
In your configuration,
<VirtualHost *:443>
ServerName my_kandan_site.com
# Redirect it to my local kandan app
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
There should be a line to close the <VirtualHost *:443>. Otherwise, this is a syntax-related misconfiguration.
The correct one would be:
# Capture all HTTP traffic and rewrite it to use HTTPS
<VirtualHost *:80>
# redirect user to https
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>
# Capture all HTTPS traffic to my_kandan_site.com.
<VirtualHost *:443>
ServerName my_kandan_site.com
# Redirect it to my local kandan app
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
</VirtualHost>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/InCommon.pem
SSLCertificateKeyFile /etc/ssl/private/my_kandan_site.key
Hello,
I'm trying to make a solid docker container for kandan and I'm stuck at trying to run kandan in a subdirectory.
I got it all working as root application
I load up localhost:3000
Everything works fine
When I run instead:
I load up localhost:3000/kandan
I get an error: The page you were looking for doesn't exist (404)
Any help appreciated!