Laravel 5.1 Snappy problems with Authentication - laravel-5.1

I am using Barrydvh\Snappy for PDF generation on my Laravel 5.1 application.
The PDF must be generated once the user has logged in, as that view must be kept private.
It seems that the shell opened by wkhtmltopdf creates a parallel session, therefore there is no user authenticated, and I get back the login route instead of the desired private view.
Does anyone know how to handle this?
Thank you all in advance.
Best regards,
Marta

I was able to make it work by having Snappy reference a view rather than a route. That way I avoided having to deal with the authentication.
$pdf = \PDF::loadView('viewName', compact($data));
return $pdf->download('name.pdf');
I had to edit the hosts file on server to add 127.0.0.1 referencing my application domain.

Related

setting up subdomain in url locally

I am creating a rails application where we have functionality for registering a new User is there and there we are providing separate sub domain for each user by their user name.
so i want to map
user_name.localhost:3000.com where user_name is dynamic
Run your local development server with pow. If you symlink the app to the foo, than your pages are available under http://foo.dev, but also under every other subdomain like http://bar.foo.dev. There is no need to register a list of subdomains somewhere.
prax might be an alternative when you are on linux.
Access like this. No configuration required
user_name.lvh.me:3000
I have figured it out.
Actually the application is using subdomain_fu gem for creation of the subdomain and when the user is created the subdomain is name is saved in the db and the can accessed by making configuration into the file C:\Windows\System32\drivers\etc\hosts and map the ip which is being hit like ;
192.xxx.xx.xxx user_name.your_subdomain _name
and hit the url like this ;
user_name.your_subdomain _name:3000
It is working fine with me doing these steps.
Thanks to all for their valuable feed back.

Http settings for Processmakers

I know there is a way to set your processmaker in such you can access it by using the following format:
processmaker.example.com
But is there a way to configure it in such you can access it by using:
example.com/processmaker/
Thank you and good day.
ProcessMaker is configured to respect the structure: xxx/sysworkflow/en/classic/login/login, so changing it to:
http://XXX.XXX.XXX.XXX/processmaker/
it won't work unlike wordpress that you have the possibility to create subfolders.
In the case of ProcessMaker domains or ports are created to have access. In your case you can create a rule to redirect your URL to processmaker login, it means when you enter to
XXX.XXX.XXX.XXX/processmaker/
it redirects to:
xxx/sysworkflow/en/classic/login/login
You need to modify your .htaccess file or pmos.conf file depending on how you installed ProcessMaker.
This information may help you to redirect your URL.
Regards.
processmaker
Unfortunately, ProcessMaker needs to be on the root of any server configuration. This is due to the .htaccess configuration file, which goes to sysGeneric.php.
Another problem is that the application uses full paths (e.g. /js/maborak.js) and it won't work on a folder unless you modify the templates.

How to serve a defined path with Meteor?

Currently I'm connecting to my meteor project using http://localhost:3000 which uses my meteorApp.html file.
How could I make Meteor respond to the following url:
http://localhost:3000/otherPath ?
To be more explicit, I do have a file on the server side I just would like to be able to retrieve on the client side using http://localhost:3000/nameOfTheFile.sufix
I think you can just put nameOfTheFile.sufix under public directory.
See http://docs.meteor.com/#structuringyourapp
If you want otherPath to be within meteor app, public won't do.
There are several ways to do that, http://multi-page-config.meteor.com is one way to create what looks like a traditional multipage site within one meteor process.
I did this a while ago and have since perfected it a bit but haven't updated it.. this at least might give you some ideas... you can look at the source here: https://github.com/bolora/multi-page-config

Why am I getting the message "The specified request cannot be executed from current Application Pool"?

Quite not sure why I see this error.
I navigate to my Login View like so http://test.staging.com/mywebsite/Login
My Login view was just redone using MVC but I have seen this same error message going to an aspx page as well...
If I use http I get the error message The specified request cannot be executed from current Application Pool.
If I use https://test.staging.com/mywebsite/Login, I'm good.
If I don't specify a protocol, test.staging.com/mywebsite/Login, I get the error as well
Is there an error happening under the covers and my custom error page can't be shown like discussed here?
What are some other causes of this error?
That usually means your custom errors are configured to run as a different AppPool.
You can read more at MSDN. (See section "Using Custom Errors from Another Application Pool").
There are two ways to correct this behavior. The first is possibly not one that you are interested in because it would require you to change your current architecture and run both sites in the same application pool (such as share the same worker process memory space). To do this, simply move the /errors virtual directory to run in the same application pool as the site for which it serves the custom error.
The second way is to make use of a registry key provided by IIS 6.0. This registry key makes sure IIS 6.0 does not check the metadata during the execution of the custom error and therefore allowing this to work.
See the article for information on the registry key fix.
It may also mean that you are using something along the lines of Server.Transfer to a page that is in a different AppPool.
It could be because you're using different versions of ASP.NET for one or many apps in the pool.
Make sure all apps in the pool use the same version of ASP (e.g. ASP 2.0.50727)
If you just added a new app, try changing the app momentarily to a different version of ASP, then back to same version. I experienced an issue where the displayed version was correct, but under the hood, a different version was used!
Check your event log, under Application, to get more details about the error.
The message would be caused by your page server-side redirecting to a page served by another application pool. Such as for example, in your link, the error page.
I know this is an old thread, but I stumbled upon it and found a different solution. Here's what worked for me: Make sure your application handles .asmx files correctly
From IIS:
Right Click on your project > Properties > Configuration
If necessary, add the .asmx file extension that maps to the aspnet_isapi.dll
Limit to: "GET,HEAD,POST,DEBUG" and restart.
Because I can't comment on vcsjones's answer, I'll add it down here. The DWORD value IgnoreAppPoolForCustomErrors needs to be set under HKLM\SYSTEM\CurrentControlSet\Services\W3SVC\ Parameters vs HKLM\SYSTEM\CurrentControlSet\Services\W3SVC referenced in that technet article. Set it to 1 and do an iisreset and you're good to go.
Source Blog Post
In my particular case, I received this error while trying to serve a content (non ASP.NET) website while it was an Application. Right-Clicking the virtual folder and removing the application fixed it for me.
In my case the application used the application pool that didn't exist. I have no idea how it's happened.

Grails/Spring Security: Unable to login with a newly created user

I have just started using grails and installed the spring-security and spring-security-ui plugins. I am following the tutorial given here. The application starts with one bootstrapped user me with ROLE_ADMIN permission.
With the UI override scripts I was able to get the register functionality up and running and it works all right. Now, I have installed the User Management scripts (grails s2ui-override user) to try adding, editing, removing users.
A new user gets created fine, I have checked this against the HSQLDB instance. However, if I now log-out from the application and try to login with the newly created user the application tells me that it is unable to find a user with the provided username and password.
I haven't modified the default logout handling so am using /j_spring_security_logout which as the documentation says invalidates the session.
Is this a know issue? If so how can I get around this or if not how can I debug this issue?
EDIT:
This issue is also persisting without the UI addition. Register as a new user. Once you finish e-mail verification you are auto-logged in to the site. Now logout and try to login in back again. It gives the same error.
FINAL EDIT:
The UI plugin comes with the RegisterController that still encodes the password. However, the newer domain classes that come with the core are also doing this and the recommended practice is that controllers shouldn't. I commented out a line that does the encoding and the login/logout works now at least for the basic scenario.
There is a warning on that tutorial
Earlier versions of the plugin didn't include password encryption logic in the domain class, but it makes the code a lot cleaner.
I am guessing security-ui plugin does not know about that change, and comparing unencrypted password with the encrypted one on the database.
l managed to fix my problem. The problem was double encryption. Under the spring security ui in the user controller on line 41 the password was being encrypted and then again by the domain class so on login it was comparing a double encrypted password and a single encrypted password. To solve the problem l just commented out line 41 in the user controller which was encrypting the password
EDIT: If you have trouble figuring out where one would go to edit the controller, you can find the source code of the downloaded plugins in your user home's
/.grails/version/projects/projectname/plugins
directory for editing (at least on Mac / Linux, dunno where you'd find it in windows).

Resources