Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue accessing API routes over HTTPS #6

Closed
mrtimp opened this issue Apr 16, 2014 · 1 comment
Closed

Issue accessing API routes over HTTPS #6

mrtimp opened this issue Apr 16, 2014 · 1 comment

Comments

@mrtimp
Copy link

mrtimp commented Apr 16, 2014

I had an issue where it looked like Laravel was throwing a NotFoundHttpException exception and Dingo was returning a JSON document like:

{
"message": "404 Not Found"
}

When accessing API routes over HTTPS. I took the default code from the Dingo documentation (and excluded the Post route as I didn't have that in my application):

Route::api(['version' => 'v1'], function()
{
Route::get('users', function()
{
return User::all();
});
});

and when I was calling https://myproject/users I was getting the above error.

What is somewhat more confusing is when I reconfigured the route to:

Route::group([ 'version' => 'v1' ], function() {
{
Route::get('users', function()
{
return User::all();
});
});

I didn't get any error. I did some more investigation and I found a similar issue on the Laravel IO forums:

http://laravel.io/forum/03-21-2014-https-definition-in-routesphp

this forum post indicated someone had had similar issues when accessing standard routes over HTTPS. My use case was slightly different as I was using Apache 2.2 rather than Nginx but when I followed their instructions and adjusted the Laravel Illuminate\Routing\Route::httpOnly method I could access my route via Route::api and standard Route::groups.

I'm really not sure if this is a Dingo or a Laravel issue.

Any suggestions would be appreciated.

@jasonlewis
Copy link
Contributor

This should be fixed now within the API itself (1e7b469)

I've made a pull request to fix the underlying bug in Laravel (laravel/framework#4150).

Cheers Tim!

wayne5w referenced this issue Mar 17, 2016
Instead of using the existing Laravel router we will use a new instance. This
should prevent the APIs internal dispatcher from overriding the current route
on the actual Laravel router instance.

There does not seem to be any need for the router instance that is injected
into the adapter to be the actual Laravel router, as the adapter just needs
an instance to dispatch the API-only routes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants