fix: resolve Sveden upload permissions and CSRF cookie issue
- Add hostgroup (GID 1000) to Dockerfile so www-data inside container can write to sveden/ - Add credentials: 'same-origin' to fetch calls in Sveden.vue and QuickUpload.vue to send session cookies
This commit is contained in:
@@ -55,6 +55,10 @@ RUN curl -sS https://getcomposer.org/installer | php -- \
|
|||||||
# Создание необходимых директорий для Laravel
|
# Создание необходимых директорий для Laravel
|
||||||
RUN mkdir -p storage/framework/views storage/framework/sessions storage/framework/cache storage/logs bootstrap/cache
|
RUN mkdir -p storage/framework/views storage/framework/sessions storage/framework/cache storage/logs bootstrap/cache
|
||||||
|
|
||||||
|
# Добавляем www-data в группу с GID=1000 (совпадает с GID хост-пользователя)
|
||||||
|
RUN groupadd -g 1000 hostgroup 2>/dev/null || true \
|
||||||
|
&& usermod -aG hostgroup www-data
|
||||||
|
|
||||||
# Установка правильных прав доступа
|
# Установка правильных прав доступа
|
||||||
RUN chown -R www-data:www-data storage bootstrap/cache \
|
RUN chown -R www-data:www-data storage bootstrap/cache \
|
||||||
&& chmod -R 775 storage bootstrap/cache
|
&& chmod -R 775 storage bootstrap/cache
|
||||||
|
|||||||
@@ -214,6 +214,7 @@ const upload = async () => {
|
|||||||
const response = await fetch(route('dashboard.quick-upload.store'), {
|
const response = await fetch(route('dashboard.quick-upload.store'), {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData,
|
body: formData,
|
||||||
|
credentials: 'same-origin',
|
||||||
headers: {
|
headers: {
|
||||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
|
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
|
||||||
'X-Requested-With': 'XMLHttpRequest',
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
|
|||||||
@@ -216,6 +216,7 @@ const upload = async () => {
|
|||||||
const response = await fetch(route('dashboard.sveden.store'), {
|
const response = await fetch(route('dashboard.sveden.store'), {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData,
|
body: formData,
|
||||||
|
credentials: 'same-origin',
|
||||||
headers: {
|
headers: {
|
||||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
|
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
|
||||||
'X-Requested-With': 'XMLHttpRequest',
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
|
|||||||
Reference in New Issue
Block a user