Heroku PHP app getting 302 error on some links, not others - apache

I'm migrating a working PHP app from my localhost, XAMPP, to Heroku and a few of my links give me a 302 error and the load page says:
"This page isn’t working
mywebsite.heroku.com sent an invalid response.
ERR_INVALID_REDIRECT"
Here is my code for that particular link:
Admin
Here's the code for another broken link that does the same thing:
Login/Register
HOWEVER, here is the code for the link directly beneath that one that works perfectly:
View Cart
Here's the code that has that variable defined.
$web_url = "https://" . $_ENV["HTTP_HOST"] . "/";
EDIT: I've narrowed it down to links that take users to pages where data is entered. It's an ecommerce website so account registration, login, admin login, and checkout where the user enters billing info and credit card.
I think it has to do with the apache server. I do -not- have an .htaccess file so there's nothing in there that would cause this redirect.
Any ideas are appreciated. I am trying to avoid spending a week reading the entire apache documentation.

would suspect the problem to be here...
$app_path = '/' . $dirs[1] . '/' . $dirs[2] . '/';
which should rather be (due to zero-based indexes):
if(sizeof($dirs) == 2) {
$app_path = '/' . $dirs[0] . '/' . $dirs[1] . '/';
}
better rewrite with mod_rewrite, before the request hits any script.
... and when developing on the localhost, xdebug is a good tool.

Related

$.get request shopify error

I've have weird issue, on dev theme (preview mode) $.get request works fine -> https://woolet-co.myshopify.com/blogs/news
but on active theme on main domain https://woolet.co/blogs/news there is an error, I can't figure it out why its happening.
If you try this code in console on both URLs you will see the response code error on main domain:
$.get('/admin/blogs/19692355/articles/229491718.json', function(data) {
console.log(data);
});
I guess that it's connected with domains, on https://woolet-co.myshopify.com/blogs/news $.get request works fine and on https://woolet.co/blogs/news it shows error in console.
I've tried to execute $.get request through Shopify Private App with login and password included but without any result.
This isn't working for you because your XMLHttpRequest is for a different domain than the one the page is on.
For this to properly work, you need to enable CORS. I would also suggest putting in the absolute URL of where this JSON file is located.
It would work on your preview mode. Because there both shop url and admin url are on same domain
https://woolet-co.myshopify.com/blogs/news
But when you try to browse using your real domain "https://woolet.co/". The domain from where you are making the get request and the domain from where the file is coming becomes different. ( https://woolet-co.myshopify.com/admin/blogs/19692355/articles/229491718.json )
As far i know you can not enable cors on shopify
and
It wont work because "https://woolet-co.myshopify.com/admin/blogs/19692355/articles/229491718.json" requires you to be logged it to the store as admin.
Try some other way.

Google + Redirect URI errors

... When creating Google API if anyone gets an error like this "Invalid Redirect URI". So below I will be posting my solution also that helped me and will save your time.
Trying to find out the mystery about redirect uris myself too but as far as i know you must save the redirect uri you are using in your app into the settings of the api console. Select your project and then clik on the crdentials on the left bar. Yo ucan't miss it

App page tab geting 404 on good url

I created an app (id:155124624522900 - https://developers.facebook.com/apps/155124624522900)
And it is supposed to work as page server for Business Pages (as a tab)
But I get this code when trying to access from my debug app:
App Temporarily Unavailable The URL
The URL http://foodtreedevfb.herokuapp.com/tab returned a 404 Not Found error.
Still, the url is good! I wonder what is happening.
I am serving from Play Framework on Heroku.
EDIT
it may be related to some trailing slash issue on the uri, still I changed and it didn't help.
Is your app redirecting when Facebook sends the POST request? this can happen if your URLs in Facebook's settings are setup without the trailing '/'
Also, check your index file allows POST requests - i'm not sure if heroku have any such restrictions but many other servers won't allow POST requests to some URLs

Enabled SSL gives issues

I really dont know what is the problem nor does my website hosting providers. Im using wordpress to run my business and Im using a shop plugin called "Shopp". Whenever I fill in the Paypal Pro details to process credit card on my website, I get teh following on the checkout page: "Firefox has detected that the server is redirecting the request for this address in a way that will never complete."
I can assure you that the plugin has nothing to do with it as I have tried different shop plugins. Can someone help? The url is www.imayne.co.uk/shop/checkout
Few info:
I have SSL automatically installed by my provider
Hosted package was said to be Linux
Usually that's caused by a page (or pages) that simply redirect to each other:
first.php:
<?php
header("Location: second.php")
second.php
<?php
header("Location: first.php");
or a single page that redirects to itself. check your server logs to see exactly what the requested URL is, and then look for a wordpress rule that'd cause the redirect. Possibly you're trying to redirect from non-SSL to SSL-enabled pages, but are doing the redirect wrong, so you end up back at the same page, which then tries to redirect to SSL, fails, etc...
and indeed, after trying your link, you get redirected to https://www.imayne.co.uk/shop/checkout/, which then keeps on redirecting to itself. So, your shopping car system would appear to be broken.
Your site has been removed so I don't know if you were able to solve the issue.
One thing to keep in mind when using Shopp is, you need a dedicated SSL certificate. A "shared hosting" certificate won't work.

redirection page help -apache

I have a folder where in there is a .htaccess file with some settings .. so when i try to load the page .its asks for authentication . so when i dont give the user name and passwd . it redirects to a page. i need to know where this redirection settings are there . how to get to the core.
This question is not terribly clear.
It sounds like you have authentication set up in your .htaccess file. If authentication fails, Apache returns a 401 Unauthorized (or 403 Forbidden) response. You might try redefining the error pages for those two errors using the ErrorDocument directive.