mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-02-19 20:01:24 +01:00
Add support for custom base URL - resolve #114
This commit is contained in:
parent
17137b9885
commit
8f6bf85fa8
@ -22,6 +22,7 @@ public function index()
|
|||||||
'appConfig' => collect([
|
'appConfig' => collect([
|
||||||
'proxyAuth' => config('auth.defaults.guard') === 'reverse-proxy-guard' ? true : false,
|
'proxyAuth' => config('auth.defaults.guard') === 'reverse-proxy-guard' ? true : false,
|
||||||
'proxyLogoutUrl' => config('2fauth.config.proxyLogoutUrl') ? config('2fauth.config.proxyLogoutUrl') : false,
|
'proxyLogoutUrl' => config('2fauth.config.proxyLogoutUrl') ? config('2fauth.config.proxyLogoutUrl') : false,
|
||||||
|
'subdirectory' => '/' . config('2fauth.config.appSubdirectory') . '/',
|
||||||
])->toJson(),
|
])->toJson(),
|
||||||
'lang' => App::currentLocale(),
|
'lang' => App::currentLocale(),
|
||||||
'isDemoApp' => config('2fauth.config.isDemoApp') ? 'true' : 'false',
|
'isDemoApp' => config('2fauth.config.isDemoApp') ? 'true' : 'false',
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
'isTestingApp' => env('IS_TESTING_APP', false),
|
'isTestingApp' => env('IS_TESTING_APP', false),
|
||||||
'trustedProxies' => env('TRUSTED_PROXIES', null),
|
'trustedProxies' => env('TRUSTED_PROXIES', null),
|
||||||
'proxyLogoutUrl' => env('PROXY_LOGOUT_URL', null),
|
'proxyLogoutUrl' => env('PROXY_LOGOUT_URL', null),
|
||||||
|
'appSubdirectory' => env('APP_SUBDIR', ''),
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -5,6 +5,13 @@
|
|||||||
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
|
|
||||||
|
# Uncomment and set the RewriteBase path to the desired subdirectory if you want to
|
||||||
|
# serve 2FAuth from a domain subdirectory like https://mydomain/2fauth/
|
||||||
|
#
|
||||||
|
# WARNING: the subdirectory value must match the one set in your .env file
|
||||||
|
# Do not forget leading and trailing slashes.
|
||||||
|
#RewriteBase /subdir/
|
||||||
|
|
||||||
# Handle Authorization Header
|
# Handle Authorization Header
|
||||||
RewriteCond %{HTTP:Authorization} .
|
RewriteCond %{HTTP:Authorization} .
|
||||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||||
|
4
resources/js/api.js
vendored
4
resources/js/api.js
vendored
@ -8,6 +8,10 @@ Vue.use(VueAxios, axios)
|
|||||||
Vue.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
Vue.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
||||||
Vue.axios.defaults.headers.common['Content-Type'] = 'application/json'
|
Vue.axios.defaults.headers.common['Content-Type'] = 'application/json'
|
||||||
|
|
||||||
|
if (window.appConfig.APP_SUBDIRECTORY) {
|
||||||
|
Vue.axios.defaults.baseURL = window.appConfig.subdirectory;
|
||||||
|
}
|
||||||
|
|
||||||
Vue.axios.interceptors.response.use(response => response, error => {
|
Vue.axios.interceptors.response.use(response => response, error => {
|
||||||
|
|
||||||
// Return the error when we need to handle it at component level
|
// Return the error when we need to handle it at component level
|
||||||
|
1
resources/js/routes.js
vendored
1
resources/js/routes.js
vendored
@ -31,6 +31,7 @@ import About from './views/About'
|
|||||||
|
|
||||||
const router = new Router({
|
const router = new Router({
|
||||||
mode: 'history',
|
mode: 'history',
|
||||||
|
base: window.appConfig.subdirectory ? window.appConfig.subdirectory : '/',
|
||||||
routes: [
|
routes: [
|
||||||
{ path: '/start', name: 'start', component: Start, meta: { requiresAuth: true }, props: true },
|
{ path: '/start', name: 'start', component: Start, meta: { requiresAuth: true }, props: true },
|
||||||
{ path: '/capture', name: 'capture', component: Capture, meta: { requiresAuth: true }, props: true },
|
{ path: '/capture', name: 'capture', component: Capture, meta: { requiresAuth: true }, props: true },
|
||||||
|
@ -149,7 +149,7 @@
|
|||||||
|
|
||||||
beforeRouteEnter (to, from, next) {
|
beforeRouteEnter (to, from, next) {
|
||||||
if (to.params.forceRefresh && from.name !== null) {
|
if (to.params.forceRefresh && from.name !== null) {
|
||||||
window.location.href = to.path;
|
window.location.href = "." + to.path;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
resources/views/landing.blade.php
vendored
10
resources/views/landing.blade.php
vendored
@ -16,8 +16,8 @@
|
|||||||
<link rel="apple-touch-icon" href="{{ asset('favicon_lg.png') }}" />
|
<link rel="apple-touch-icon" href="{{ asset('favicon_lg.png') }}" />
|
||||||
<link rel="apple-touch-icon-precomposed" href="{{ asset('favicon_lg.png') }}" />
|
<link rel="apple-touch-icon-precomposed" href="{{ asset('favicon_lg.png') }}" />
|
||||||
<link rel="manifest" href="/manifest.json">
|
<link rel="manifest" href="/manifest.json">
|
||||||
|
|
||||||
<link href=" {{ mix('css/app.css') }}" rel="stylesheet">
|
<link href=".{{ mix('css/app.css') }}" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
<body class="has-text-lighter">
|
<body class="has-text-lighter">
|
||||||
<div id="app">
|
<div id="app">
|
||||||
@ -31,8 +31,8 @@
|
|||||||
var isTestingApp = {!! $isTestingApp !!};
|
var isTestingApp = {!! $isTestingApp !!};
|
||||||
var appLocales = {!! $locales !!};
|
var appLocales = {!! $locales !!};
|
||||||
</script>
|
</script>
|
||||||
<script src="{{ mix('js/manifest.js') }}"></script>
|
<script src=".{{ mix('js/manifest.js') }}"></script>
|
||||||
<script src="{{ mix('js/vendor.js') }}"></script>
|
<script src=".{{ mix('js/vendor.js') }}"></script>
|
||||||
<script src="{{ mix('js/app.js') }}"></script>
|
<script src=".{{ mix('js/app.js') }}"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue
Block a user