Skip to content
Advertisement

API routes using Https on laravel gives 404

I created an Laravel API.

First, it was using HTTP, I needed to change it to use https.

So I created an account on Cloudflare and since then when I go to my API endpoints:

GET: https://www.traapp.tk/api/data/20190809 it gives a 404:

Not Found

The requested URL /api/data/20190809 was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

I also have a POST request and that returns a 404 to.

.htacces

JavaScript

api.php

JavaScript

MainController

JavaScript

I tried solutions like these:

Force Laravel to use HTTPS version

How to implement HTTPS in laravel 5.4

Advertisement

Answer

That’s a 404 from your Web server not from your laravel. I guess you forgot to change the declared port in your Vhost configuration from 80 to 443.

Cloudflare example:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement