Load swagger UI contents in https - Lumen - laravel

I have hosted my Lumen(version : 5.7.8), in my apache server. The site has been accessed using https. So in App\Providers\AppServiceProvider I have added
public function boot()
{
\URL::forceScheme('https');
}
When I run swagger,which I have installed using DarkaOnline, it is showing blank page and got the following error in the console.
Uncaught ReferenceError: SwaggerUIBundle is not defined
And all swagger ui css and js files still shows its path loading from http, which ends up in following error in console.
Blocked loading mixed active content
Should I need to enable or do something more to load everything in https ?
I am using swagger 1.0.0 , OAS3

Related

H2 console not loading, with error No Javascript

getting Error loading h2 console localhost:8080/h2-console showing following text
Welcome to H2
No Javascript
If you are not automatically redirected to the login page, then Javascript is currently disabled or your browser does not support Javascript. For this application to work, Javascript is essential. Please enable Javascript now, or use another web browser that supports it.
using spring boot with embedded database h2, I have added parameters
http.csrf().disable();
http.headers().frameOptions().disable();
solved it by removing following line
.headers().contentSecurityPolicy("default-src 'self';").

laravel api displays error Target class does not exist on production (cpanel)

I deployed my laravel api to cpanel
but I am getting this error
Target class [App\http\Controllers\EmployeesController] does not exist.
even though the controller is in the correct folder
It works fine on localhost but on cpanel(production) it displays the error
api.php
Route::resource('/employees', EmployeesController::class);
Route::resource('/companies', CompaniesController::class);
Route::resource('/contacts', ContactsController::class);
Route::resource('/managers', ManagersController::class);

some laravel route not changing to https

There are some my route not going to HTTPS in my Javascript code
loadSettingTable("{{ route('setting.table.data.datatable') }}");
they become like this, so my datatable can't be load because mixed content.
loadSettingTable("http://*****.com/admin/data-setting-table/datatable");
but my css and JS file already become HTTPS.
I already give this on my AppServiceProvider and ENV
//AppServiceProvider.php on Boot
if(env('REDIRECT_HTTPS')) {
$url->formatScheme('https');
URL::forceScheme('https');
}
//.ENV
REDIRECT_HTTPS=true
But some of it work fine with this code, why my code with route name not giving https?
loadTableRealCommSumAgent("/agent/commissions-summary-member-ajax");
I found the error myself, but don't really know why this error happens on my production server not staging server. I remove $url->formatScheme('https'); because it giving some error on production but not always and it's fixed my problem.

Trying to set up CAS with my Laravel project

I am using subfission/cas for my application. I have followed all installation steps. I am using windows, if that matters. More precisely, I have configured the following:
I ran the following in my terminal
composer require "subfission/cas" "dev-master"
I configured my Kernel.php accordingly, adding the following:
'cas.auth' => 'Subfission\Cas\Middleware\CASAuth',
'cas.guest' => 'Subfission\Cas\Middleware\RedirectCASAuthenticated',
I ran the following command:
php artisan vendor:publish
I also set up my cas server in my cas.php config file:
'cas_hostname' => env('CAS_HOSTNAME', 'cas.myserver.me'),
'cas_real_hosts' => env('CAS_REAL_HOSTS', 'cas.myserver.me'),
What I want is a middleware for all my routes, so I added the following route rule in my routes:
Route::middleware(['cas.auth'])->group(function ()
{
Route::get('/', function ()
{
return view('welcome');
});
});
Basically, I want to redirect everyone who is not logged in to the login page whenever I access the main page (for now, I will add more routes in the future). What happens is that the users are redirected to the login page when they are not logged in, but after the login I receive the following error:
ErrorException (E_WARNING)
DOMDocument::loadXML(): Opening and ending tag mismatch: hr line 1 and body in Entity, line: 1
No matter what view I'm redirecting the user to. I tried the default welcome page as well as an empty view, but I still get the same error.
EDIT: I have used the dev-master branch from subfission/cas for the above error and after switching to 2.1.1, I get a different error:
session_name(): Cannot change session name when headers already sent
EDIT 2: I did some more digging and I enabled internal errors in my cas client class with:
libxml_use_internal_errors(true);
And now I get the following:
Authentication failure: SA not validated Reason: bad response from the CAS server
And the cas response is:
The thing is that I use the same cas server for another 2 projects and it works well for those (but those aren't laravel projects.
I know it's been a while, but for anyone else having issues like this, the issue is the protocol selected for which your web service communicates with your CAS(Central Authentication Service) provider. There are two main protocols used for SSO/CAS in this package:
SAML(Security Assertion Markup Language) version 1.1 & 2
CAS Protocol v3.0
[Confusingly enough, CAS protocol shares the same namespace as the service.]
The idea is to match the protocol and version with your identity provider. It sounds like your provider is using CASv3.0, which is why disabling SAML worked.
Also, if you enable debug mode, you will see further error details in your log file to help your troubleshoot.
Best of luck!
I managed to solve the issue by disabling the SAML in the cas configure file:
'cas_enable_saml' => env('CAS_ENABLE_SAML', true),
change to
'cas_enable_saml' => env('CAS_ENABLE_SAML', false),

Laravel 4 : why did I get 2 different of 404 error page?

I'm using Laravel 4.2 framework for my website, and want it catch my 404 error correctly. My problem is that the server return a different 404 page when I try to open some bad link inside the public folder. Please give me some advice, thank you very much.
Folder structure:
-- app
-- bootstrap
-- public
--assets
--packagespage
-- vender
Normally, I set my 404 page like this:
When I tried http://localhost:8000/assets/some-name and http://localhost:8000/packages/some-name => new 404 page here:

Resources