J
J
Julia Kovalenko2018-05-07 12:40:39
Nginx
Julia Kovalenko, 2018-05-07 12:40:39

Laravel 5.5 HTTP->HTTPS?

Hello!
There is an application on two domains app.ru and api.app.ru.
All connections were http. We decided to change everything to https.
https://app.ru works correctly.
But when I try to send data from the form from app.ru to api.app.ru I get:

Request URL: https://api.app.ru/test
Request Method: POST
Status Code: 401

{"message":"Unauthenticated."}


When comparing requests, I noticed that the
Cookie header is sent via http: app_session=...; laravel_token=...; XSRF-TOKEN=...

It is not sent over https.

Here are sample requests:

HTTP:
5af01e1061d06646797424.png
HTTPS:
5af01e143d8dd612646026.png

What could be the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
Julia Kovalenko, 2018-05-08
@kovalenko_jul_s

The problem was that the cookies with tokens were set to the wrong domain.
Solution: fix in session.php config
'domain' => '.app.ru',

R
Rikcon, 2018-05-07
@Rikcon

in .env what is the APP_URL ?
http or https?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question