Https problems with routes

Posted 2 years ago by eriktobben

Hi!

So I've been working on a very simple API and I have been testing it for a while with no SSL-certificate. After I installed a Let's Encrypt certificate through Forge I get a strange error.

My routes look look like this:

Route::get('email', '[email protected]')->name('email.index');
Route::post('email/send', '[email protected]')->name('email.send');
Route::get('email/{id}', '[email protected]')->name('email.show');

On all routes I have a Token validation that gets passed as a header on the GET-routes and as part of the request body on the POST-route.

Problem: If I send a POST request to api.domain.com/email/send I expect to get a response back with the email ID but instead I get a token validation error. After some testing I find that this particular message gets generated by [email protected] That was not the case before I added SSL. If I test the same route in Homestead everything works great.

If I do the same request to https://api.domain.com/email/send everything works as expected.

I find it strange that adding a SSL-certificate will change how the server handles the POST request and sends is to a route that is only defined as GET. There have been no changes to the code and the same code is working fine in Homestead (without SSL)

Please sign in or create an account to participate in this conversation.