1

In a template I include the components via subrequests via:

{% extends 'HnDocumentBundle:Default:PrintableDocumentLayout.html.twig' %}

{% block printable_document_content %}
    {{ render(controller('HnDocumentBundle:Component/TraineeEducationVoucher:educationVoucherBackToAgencyAgent', { trainee: trainee.id })) }}
{% endblock %}

The fragments do not have a route name defined, and I do not want them to have one.Yet I still want to be able to access the fragments directly in development mode.

I was working under the assumption that fragments become available by making my local machine accessing the site a trusted proxy. I hence configured the framework:

framework:
    trusted_proxies:
        - 192.168.56.1
    fragments:
        enabled: true
        path: /_fragment/

Over the debug toolbar I get the link to the fragment, it looks as expected:

http://localhost.dev/app_dev.php/_fragment/?_path=_format%3Dhtml%26_locale%3Dde%26_controller%3DHnDocumentBundle%253AComponent%252FTraineeEducationVoucher%253AeducationVoucherBackToTrainee

Yet once I try to access in browser directly, I get the access denied exception. I would expect that to happen in production, yet not in development.

What am I doing wrong? How do I make the fragment urls available on development?

k0pernikus
  • 60,309
  • 67
  • 216
  • 347

0 Answers0