I have a question with a probable obvious answer that I need to understand. I have come to the point where I need to "Add CORS headers to the server". I haven't been able to find a comprehensive guide of how to do this in Heroku. Or is is something that doesn't have to do with Heroku?
This isn't something that you set at the Heroku level. You'd need to set CORS headers in the language/framework in which your application is written. This would be whatever is in the web: section of your Procfile.
If you give more details about your application, and tag the question with the framework/language, you'll probably get a more precise answer (whether from me or somebody else).
Related
I have an app (similar to the Employee Directory example) that pulls down a JSON file from the client's server on a daily basis (Business Continuity info that rarely changes).
Currently I have the URL as a variable in my globals.js which points to their internal web server.
They now want to make the URL variable point to a URL which is in fact a URL redirect. The redirect will be dynamic (well, sort of) that will point to where the file resides.
The "autoRedirect" property does not seem to be working for this on either the iOS or Android builds.
Does anyone have any ideas as to how I can do this?
Could it be that the redirects switches protocol? Like from http to https or visa versa? Because that might indeed not work as its considered bad practice.
If not, then it it looks like you've found a bug. Please check if this is a known issue at the Appcelerator JIRA. If it's not, create a ticket, link to this question but also provide reproducible code, steps and environment information in the ticket itself. Don't forget to drop a link to the ticket here so that others can watch it with you.
The problem is very simple, but solving it is very confusing for me, please help :)
Problem:
when going to my project site: duskoflife.com and logging in, everything works fine.
However! When going to www.duskoflife.com and logging in, this error appears and logging in fails:
XMLHttpRequest cannot load http://duskoflife.com/login.php. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.duskoflife.com' is therefore not allowed access.
Basically the one with www is as if it is a different site, and I sort of understand why it is happening, but how to fix it?
My thoughts: maybe in the beginning detect users who visit www.duskoflife.com and redirect them to duskoflife.com? Why is there even a difference? Is this a proper approach?
Is there somewhere in code I can make the url work for both?
I am sorry if I'm a newb at this, I would love your help and solutions
What you are looking for is CORS. You need to enable it in your server. Now to enable cors you need to modify the http response header sent by your server. It is usually a two or three lines of extra code depending upon your server side language php, .NET etc. You can easily find a code snippet from the following link:
http://enable-cors.org/server.html
Alternatively, you can modify your .htaccess file to redirect www yourdomain.com to yourdomain.com
Let me preface this by saying Im somewhat self taught with things, and may not use correct terms. I hope that that doesn't hinder getting help. Also, this is my first Stack Overflow question, so have some grace, please... if it's not appropriate formatting, etc.
I'm trying to set up hover.com DNS settings, etc. so that I can enter in a domain name, and then have it point to my myapp.herko.com.
Essentially pointing
thisismydomain.com/about -> myapp.heroku.com/about and so on.
I've looked in the hover.com help in re: to domain forwarding, as well as other stack overflow questions related to DNS Simple, hoping that it'd rub off on my inquiry and I'd be able to figure it out.
I'm kind of stumped though. I hope you can help me. I've been doing wordpress stuff for years, and am finally excited about learning Ruby on Rails. I feel like if I can push things quickly via Heroku and see them live on my site, it will be a big boost of confidence in a sometimes bewildering endeavor.
Thanks in advance!!
Right ok, no worries. We all start somewhere. DNS is full of nasty terms.
Assuming you've already registered thisismydomain.com with Hover and you have a Heroku application called myapp.
In the Hover control panel you want to find the domain, select the domain and click the DNS option in the tab bar to edit the records for it. If you already see www in the list of records you will need to delete it and add it back and when you get the option for record type to create you want to make sure you select CNAME. If it doesn't already exist just use the Add Record button. You will then need to enter a hostname of www and the value should be myapp.herokuapp.com.
Once you've done that you will need to go to your application via the Heroku control panel > Settings and in the Domain section you need to enter www.thisismydomain.com. Once you've done that and the DNS has propogated (it takes a while for changes to DNS to go around the world, sometimes up to 48 hours) going to www.thisismydomain.com should end up on your application.
If you REALLY want to use the domain without a www prefix then I suggest you read:
http://www.neilmiddleton.com/the-dangers-of-a-records-and-heroku/
Custom root domain on Heroku
which attempt to talk you out of it or around it.
Specifically, I'm trying to change the register_redirect in the system/cms/modules/users/config/ion_auth.php config file.
Is there some place to put my application specific configs?
Potentially.
Config files like this are not meant to be entirely untouchable, but I understand that it feels like "hacking the core". If you're tracking your site with Git then its a non-issue, because you can pull updates without overriding the changes.
Alternatives solutions are a little tricky as the "post_user_register" event is running before it sends out activation emails and the like. That would be a good place to put your own redirect, but that would mean no users get their welcome emails so this is not a good idea.
Really you'll need to use Git for this as described above. Ion Auth is not a very flexible solution these days, compared to the awesome "Sentry" auth system being implemented for 2.3.
I'm able to set session var's & get them too. BUT, the documentation for cherrypy.lib.cptools.SessionAuth is too cryptic for me to get anything out of it. I tried some things in code, but it either resulted in errors or blank pages. The tutorial on the site doesn't get into session auth. I did find an old tutorial about making a blog in CherryPy 2.x, but that seems a bit outdated to work with CherryPy 3.2.2. Can anyone point me to a real tutorial for this or give a code example so I can see how to make it work? I really don't know where else to look or ask, and this is gettin' frustrating.
I use this version of authentication. Works well for me...
https://github.com/cherrypy/tools/blob/master/AuthenticationAndAccessRestrictions