Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8584543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:47:52+00:00 2026-06-11T21:47:52+00:00

I’ve got a Grails application, using spring-security plugin, deployed on Tomcat and I have

  • 0

I’ve got a Grails application, using spring-security plugin, deployed on Tomcat and I have Apache Httpd server in front of it.
I would like to deploy few php scripts, which perform some file operations, on the httpd server. This seems to be easy, however I’m wondering, if it’s possible, to restrict access to these scripts, so that only clients authenticated in my Grails app would be able to execute them?

I just want to restrict access to the scripts, but on the other end, I don’t want to move them to Groovy/Java due to performance reasons [I don’t want to waste Tomcat time for these tasks].

EDIT:
the php script results in a file [up to 1MB] which is then transferred to the client.
I’ve read this and thought about this reverse proxy from tomcat to httpd, however I’m worried about impact it will have on Tomcat.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:47:53+00:00Added an answer on June 11, 2026 at 9:47 pm

    You can do this with a little mod_perl. Below is an example solution that would need to be tweaked a little so that it only catches the URLs that you want secured and ignores everything else.

    The code below assumes some URL on the Grails server that is secured by Spring Security, and the only thing on that page is the work “ALLOWED”. I used the URL http://mywebapp.com/some-secured-page.jsp.

    The mod_perl code, in a file called MyModPerlFilter.pm is this:

    package MyModPerlFilter;
    
    use strict;
    use Apache2::RequestRec;
    use Apache2::Connection;
    use APR::Table;
    use LWP::Simple;
    
    use base qw(Apache2::Filter);
    
    use Apache2::Const -compile => qw(REDIRECT DECLINED M_GET);
    
    use constant BUFF_LEN => 1024;
    
    sub handler : FilterRequestHandler {
        my $r = shift;
    
        # check only GET requests for /*.php, ignore everything else
        if ($r->uri() =~ m|/.*\.php$| && $r->method_number == Apache2::Const::M_GET) {
    
            # grab Tomcat session ID from request
            my $jsessionid = $r->headers_in->{Cookie} =~ /JESSIONID=([^;\s]+)/ && $1;
    
            # fetch secure page with the Tomcat session ID
            my $res = get("http://mywebapp.com/some-secured-page.jsp;jsessionid=$jsessionid");
    
            # any response other than the word "ALLOWED" redirect to login form
            if ($res ne 'ALLOWED') {
                $r->headers_out->set("Location", "http://mywebapp.com/login.jsp");
                return Apache2::Const::REDIRECT;
            }
        }
    
        return Apache2::Const::DECLINED;
    }
    
    1;
    

    If the request is a GET for a URL that matches “/*.php” it will directly call a secured page on the Grails server and verifies that it returns the text “ALLOWED”. If the call to the Grails page doesn’t, it means the user isn’t authenticated and redirects them to the Spring Security login page.

    The only tricky part is grabbing the session ID from the request and including that when you call the security check URL. It assumes the session ID is stored in the cookie JSESSIONID, and that your Tomcat is set up to allow session IDs passed in the URL.

    The Apache setup requires mod_perl to be installed, and configured similar to this.

    # location of the mod_perl handler (or use the default locations)
    PerlSwitches -I/usr/local/somewhere
    
    <VirtualHost *:80>
        ...
    
        SetHandler modperl
        PerlMapToStorageHandler MyModPerlFilter
    
        ...
    
        # any proxy related stuff here
        ProxyPass / http://127.0.0.1:8080/
        ProxyPassReverse / http://127.0.0.1:8080/
    </VirtualHost>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have thousands of HTML files to process using Groovy/Java and I need to
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
I've got a string that has curly quotes in it. I'd like to replace
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.