MOD Rewrite

  • ScottG
  • Proficient
  • Proficient
  • ScottG
  • Posts: 483

Post 3+ Months Ago

OK this isn't a typical setup. just to get that out there.

The setup it three servers. client server, CMS server and well the third, *waves hand through the air* this is not the server your looking for, is the Database.

so were dealing with only two servers client and CMS

The client does a reverse proxy back to the CMS - Simple and done

httpd.conf
Code: [ Select ]
<VirtualHost *:80>
  ServerAdmin webmaster@example.com
  DocumentRoot /app/httpd/htdocs/video
  ServerName client-server.com
  ErrorLog "|/usr/sbin/rotatelogs /app/httpd/logs/video/error_log.%Y%m%d.txt 86400 -700"
  CustomLog "|/usr/sbin/rotatelogs /app/httpd/logs/video/access_log.%Y%m%d.txt 86400 -700" combined

  <Directory />
    Options FollowSymLinks
    AllowOverride All
  </Directory>

  # Enable reverse proxy pass through for access to video CMS
  <Location /admin>
    ProxyPass http://cms-server.com
    ProxyPassReverse http://cms-server.com
  </Location>

  # Enable reverse proxy pass through for access to video CMS
  <Location /admin/>
    ProxyPass http://cms-server.com/
    ProxyPassReverse http://cms-server.com/
  </Location>

</VirtualHost>
  1. <VirtualHost *:80>
  2.   ServerAdmin webmaster@example.com
  3.   DocumentRoot /app/httpd/htdocs/video
  4.   ServerName client-server.com
  5.   ErrorLog "|/usr/sbin/rotatelogs /app/httpd/logs/video/error_log.%Y%m%d.txt 86400 -700"
  6.   CustomLog "|/usr/sbin/rotatelogs /app/httpd/logs/video/access_log.%Y%m%d.txt 86400 -700" combined
  7.   <Directory />
  8.     Options FollowSymLinks
  9.     AllowOverride All
  10.   </Directory>
  11.   # Enable reverse proxy pass through for access to video CMS
  12.   <Location /admin>
  13.     ProxyPass http://cms-server.com
  14.     ProxyPassReverse http://cms-server.com
  15.   </Location>
  16.   # Enable reverse proxy pass through for access to video CMS
  17.   <Location /admin/>
  18.     ProxyPass http://cms-server.com/
  19.     ProxyPassReverse http://cms-server.com/
  20.   </Location>
  21. </VirtualHost>


on the client server i have mod rewrites to make SEO/HUMAN URIs like http://client-server.com/embed/the-slug-of-the-video
.htaccess
Code: [ Select ]
# Various rewrite rules.
<IfModule mod_rewrite.c>
 RewriteEngine on

 RewriteRule ^embed/([A-Za-z0-9\-]+)/?$ /video/embed.php?action=embed&video=$1 [L,QSA]

</IfModule>
  1. # Various rewrite rules.
  2. <IfModule mod_rewrite.c>
  3.  RewriteEngine on
  4.  RewriteRule ^embed/([A-Za-z0-9\-]+)/?$ /video/embed.php?action=embed&video=$1 [L,QSA]
  5. </IfModule>


Doing this http://client-server.com/admin/ dose the reverse proxy back to the CMS no issues here

I like consistency and here's where i get my issue. trying to setup a rewrite on the reverse proxy directory give less than favorable results.

what id like to see is http://client-server.com/admin/video/ad ... -the-video
but so far no matter what i have done or tried i get a 404 //video/add/the-slug-of-the-video page not found.

Since I'm still in the building phase its not a priority task for me to complete more like it would be nice to have so i haven't put my full mind to the task of solving it.

if anyone has a though on the issue please let me know. I will continue to build and deal with this later or in between tasks. If i do solve it i will post my solution since it doing a very quick search seems to turn up either reverse proxy or mod rewrite but not both together
  • ScottG
  • Proficient
  • Proficient
  • ScottG
  • Posts: 483

Post 3+ Months Ago

So finally put some time into it and found out that I didn't have anything wrong. The issue was a dumb one. Somewhere a 301 redirect was set up on the "directory" I was mod_rewriting to on the CMS server.

so going here http://client-server.com/admin/video.ph ... -the-video would work perfectly.

But making that URI SEO/HUMAN friendly http://client-server.com/admin/video/ed ... the-video/

Would trigger the 301 redirect to http://client-server.com/video/ which doesn't exists

I clear my cache often but my history not so much. So by simply clearing the history cleared the 301 and everything worked as expected.
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8485
  • Loc: USA

Post 3+ Months Ago

It irks me that little issues like this often stumbles the progress of programming...
  • spork
  • Brewmaster
  • Silver Member
  • spork
  • Posts: 6297
  • Loc: Seattle, WA

Post 3+ Months Ago

Bogey wrote:
It irks me that little issues like this often stumbles the progress of programming...

:lol:

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 31 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.