I have a unique set-up I am trying to determine if Heroku can accommodate. There is so much marketing around polygot applications, but only one example I can actually find!
My application consists of:
- A website written in Django
- A separate Java application, which takes files uploaded by users, parses them, and stores the data in a database
- A shared database accessible by both applications
Because these user-uploaded files can be enormous, I want the uploaded file to go directly to the Java application. My preferred architecture is:
- The Django-generated webpage displays the upload form.
- The form does an AJAX submit to the Java application
- The browser starts polling the database to see if the Java application has inserted the data
- Meanwhile the Java application does its thing w/ the user-uploaded file and updates the database when it’s done
- The Django webpage AJAX-refreshes a div with the results of the user upload once the polling mechanism sees that the upload is complete
The big issue I can’t figure out here is if I can get both the Django the Java apps either running on the same set of dynos or on different dynos but under the same domain to avoid AJAX cross-domain issues. Does Heroku support URL-level routing? For ex:
- Django application available at http://www.myawesomewebsite.com
- Java application available at http://www.myawesomewebsite.com/javaurl/
If this is not possible, does anyone have any ideas for work-arounds? I know I could have the user upload the file to Django and have Django send the request to Java from the server-side instead of the client side, but that’s an awful lot of passing around of enormous files.
Thanks so much!
Heroku does not support the ability to route via the URL. Polyglot components should exist as their own subdomains and operate in a cross-domain fashion.
As a side-note: Have you considered directly uploading to S3 instead of uploading to your app on Heroku which will then (presumably) upload to S3. If you’re dealing with cross-domain file uploads this is worth considering for its high level of scalability.