Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
302 Redirects on Heroku
  • Heroku is throwing repeated 302 redirects for all urls going to the base URL, and I don't know why. Everything works fine locally on my dev server.

    Procfile:

    web: fuel/vendor/bin/heroku-php-apache2 web/

    .htaccess:

    <IfModule mod_rewrite.c>
    RewriteEngine on
    Options +FollowSymLinks -Indexes

    # Remove index.php from URL
    RewriteCond %{HTTP:X-Requested-With} !^XMLHttpRequest$
    RewriteCond %{THE_REQUEST} ^[^/]*/index\.php [NC]
    RewriteRule ^index\.php(.*)$ $1 [R=301,NS,L]

    RewriteRule ^(/)?$ index.php/$1 [L]

    # Send request via index.php if not a real file or directory
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>

    Pages that actually exist get loaded.

    404s work correctly, loading a 404 page:

    2015-11-04T19:13:55.489566+00:00 heroku[router]: at=info method=GET path="/admin/test/" host=my.url request_id=b4c4853b-69fe-444e-b03b-5eea7c10b018 fwd="73.218.177.115" dyno=web.1 connect=1ms service=15ms status=404 bytes=6156

    Locations that should "exist" by being redirected to FuelPHP get redirected down to the base URL.. I try to load my.url/admin or my.url/admin/clients and I'm redirected to my.url.

    2015-11-04T19:14:08.858400+00:00 heroku[router]: at=info method=GET path="/admin/" host=my.url request_id=7a16369b-e647-4399-b11d-a1522d9766a7 fwd="73.218.177.115" dyno=web.1 connect=3ms service=19ms status=302 bytes=1235
    2015-11-04T19:14:08.894102+00:00 heroku[router]: at=info method=GET path="/" host=my.url request_id=5780087d-0847-40e6-9a44-b0dabd58577e fwd="73.218.177.115" dyno=web.1 connect=1ms service=5ms status=200 bytes=205
    2015-11-04T19:14:08.854106+00:00 app[web.1]: 10.63.87.95 - - [04/Nov/2015:19:14:08 +0000] "GET /admin/ HTTP/1.1" 302 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36
    2015-11-04T19:14:08.889796+00:00 app[web.1]: 10.63.87.95 - - [04/Nov/2015:19:14:08 +0000] "GET / HTTP/1.1" 200 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36
    2015-11-04T19:14:18.756248+00:00 heroku[router]: at=info method=GET path="/" host=my.url request_id=6eb6d76e-9f0c-4be0-b52a-220a459b9c57 fwd="73.218.177.115" dyno=web.1 connect=1ms service=4ms status=200 bytes=205
    2015-11-04T19:14:18.715333+00:00 app[web.1]: 10.63.87.95 - - [04/Nov/2015:19:14:18 +0000] "GET /admin/clients/ HTTP/1.1" 302 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36
    2015-11-04T19:14:18.719632+00:00 heroku[router]: at=info method=GET path="/admin/clients/" host=my.url request_id=b15304cf-cd01-4cd6-9613-71d332fcc5a4 fwd="73.218.177.115" dyno=web.1 connect=1ms service=19ms status=302 bytes=1235
    2015-11-04T19:14:18.752065+00:00 app[web.1]: 10.63.87.95 - - [04/Nov/2015:19:14:18 +0000] "GET / HTTP/1.1" 200 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36

    Thoughts?

  • Have you tried it with the htacess that is supplied with your FuelPHP installation?

    Afaik Heroku uses fcgi, which requires different rewrite rules...

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion