add http secure aware

dev
arm 1 year ago
parent 2fb60538ef
commit e35ba8e944

@ -51,3 +51,5 @@ VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
HTTP_SECURE=true

@ -32,8 +32,8 @@ RUN apt-get update && apt-get dist-upgrade -y && \
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install PHP extensions
RUN docker-php-ext-install pdo mysqli pdo_mysql mbstring exif pcntl bcmath gd intl zip pgsql pdo_pgsql curl xml
# Install PHP extensions - pdo mysqli pdo_mysql pgsql pdo_pgsql
RUN docker-php-ext-install mbstring exif pcntl bcmath gd intl zip curl xml
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

@ -21,6 +21,7 @@ class Kernel extends HttpKernel
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\HttpSecureAware::class,
];
/**

@ -0,0 +1,26 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\URL;
class HttpSecureAware
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next)
{
if (env('HTTPS_AWARE', false)) {
URL::forceScheme('https');
$request->server->set('HTTPS', 'on');
}
return $next($request);
}
}

@ -17,7 +17,7 @@ services:
- "/etc/localtime:/etc/localtime:ro"
mem_limit: 512m
mem_reservation: 128M
cpus: 0.5
# cpus: 0.5
networks:
- simplepos
nginx:

2
package-lock.json generated

@ -1,5 +1,5 @@
{
"name": "simple-pos",
"name": "laravel-simplepos",
"lockfileVersion": 3,
"requires": true,
"packages": {

@ -1,7 +1,7 @@
{
"private": true,
"scripts": {
"dev": "vite --host 0.0.0.0",
"dev": "vite",
"build": "vite build"
},
"devDependencies": {

@ -10,4 +10,8 @@ export default defineConfig({
}),
react(),
],
server: {
host: '0.0.0.0',
port: 5173
}
});

Loading…
Cancel
Save