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 8330979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:17:13+00:00 2026-06-09T02:17:13+00:00

What is the procedure for securing static assets (javascript and css) behind the firewall?

  • 0

What is the procedure for securing static assets (javascript and css) behind the firewall?
I have an admin section which uses javascript heavily. I don’t really want to expose the code to the public.

I currently compile all my javascript using assetic to files in /web/admin/js/xyz.js

Is there a simple way to do this that I’m overlooking?

  • 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-09T02:17:14+00:00Added an answer on June 9, 2026 at 2:17 am

    You could use a controller to serve the static file and secure that controller. Something like:

    /** 
     * Serves static javascript file. 
     * We have configured /secure to be secured by some firewall
     *
     * @Route("/secure/xyz.js", name="static_xyz")
     */
    public function staticXyzAction()
    {   
    
        $headers = array(
            'Content-Type' => 'text/javascript',
        );  
    
        return new Response(file_get_contents($this->get('kernel')
            ->getRootDir().'../web/admin/js/xyz.js'), 200, $headers);
    }   
    

    This is just an example with the data you provided. Obviously in your final code the file being served should be located in some directory which is not directly accesible by the web server.

    The obvious downside to this approach is performance. PHP is much slower for serving an static file than your web server but depending on your load this may not be an issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
the procedure: i have a script which uploads images (via hmtl-form and php) for
I have a stored procedure which contains some if statements, with the different conditions,
I have an action filter which i got from the below link http://blog.wekeroad.com/blog/aspnet-mvc-securing-your-controller-actions/ there
I have a stored procedure that is working well, it's a select query. I
I have a callback procedure: type TInitCallback = procedure (var Data: Pointer); The idea
ALTER PROCEDURE dbo.ModeratorSpamDeleteThread @ThreadsID INT AS DELETE Threads WHERE ThreadsID=@ThreadsID I have got this..But
I have a procedure named XYZ(sender:TObject) in delphi. There is one button on my
Recently a friend and I were talking about securing stored procedure code in a
I have a stored procedure with a SELECT statement that outputs one row. It

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.