mardi 14 février 2017

Mask URL for a Django + Ember Application

Background:

I have a web-app running on my server with Django (for the backend) and Ember (for the frontend). I recently bought a domain (for example... newdomain.com) on godaddy and I am trying to mask and forward this domain name to the current URL my Django app is running on (for example... olddomain.com/app).

Old URL: olddomain.com/app

New URL: newdomain.com

Goal: Mask olddomain.com/app with newdomain.com

Issue:

I put the domain name setting on godaddy as "Forward with masking" and whenever I go to newdomain.com it only forwards my URL to olddomain.com/app and never masks it. I contacted the godaddy customer service and they said it must be my server disallowing masking.

Attempts to fix it:

So I tried changing my apache settings at /etc/httpd/conf/httpd.conf with some suggestions online. I tried adding:

<VirtualHost *:80>
  ServerName newdomain.com

  ProxyPass "/*" "http://ift.tt/2l6HwxQ"
  ProxyPassReverse "/*" "http://ift.tt/2l6HwxQ"
</VirtualHost>

But it still only forwards the URL and not mask at all.

I also tried adding this to the same file and it still has the same issue as previously:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.*)\.newdomain.com
RewriteRule /(.*) http://ift.tt/2lfrS66 [P]

I also restart apache every time I do a change.

Just in case if you need it, this is my current Django + Ember settings at /etc/httpd/conf/httpd.conf for the web app:

WSGIDaemonProcess app processes=1 threads=15 python-path=/home/username/frontend:/home/username/app-venv/lib/python3.4/site-packages
WSGIProcessGroup app
WSGIScriptAlias /app /home/username/frontend/app/wsgi.py process-group=app

<Directory /home/username/frontend/app>
<Files wsgi.py>
Require all granted
</Files>
</Directory>

Alias /app/static/ /home/username/frontend/statics/
<Directory /home/username/frontend/statics>
Require all granted
</Directory>

Thanks for the help.




Aucun commentaire:

Enregistrer un commentaire