How can I add the Forwarded-Host header?
For security reasons, I need to add the Forwarded-Host header to my website, but I have no idea how to implement this.
In the file called rewrite.rules I added the code (dispatcher > conf.d > rewrites > rewrite.rules):
Hi @EvertonSa2,
rewrite rules are added in the mod_rewrite section of your VHOST file. Add your custom header directly under VirtualHost in the VHOST file. For example:
# Add Forwarded-Host header
RequestHeader set Forwarded-Host "%{HTTP_HOST}e"
Good luck,
Daniel
Views
Replies
Total Likes
Mas em qual arquivo exatamente eu adiciono esse trecho de código:
# Add Forwarded-Host header RequestHeader set Forwarded-Host "%{HTTP_HOST}e"
Não posso modificar o arquivo default.vhost, porque se eu modifica-lo a pipeline da erro.
Os arquivos que possuo são:
dispatcher > src > conf.d > enabled_vhosts > default.vhost
dispatcher > src > conf.d > enabled_vhosts > custom_headers.conf
dispatcher > src > conf.d > available_vhosts > default.vhost
dispatcher > src > conf.d > rewrites > default_rewrite.rules
dispatcher > src > conf.d > rewrites > rewrite.rules
Views
Replies
Total Likes
@EvertonSa2 let's please stick to English, so I dont have to Google Translate your question
You should create your own VHOST file, not edit the default one. It is clearly stated in the AEM archetype: https://github.com/adobe/aem-project-archetype/blob/develop/src/main/archetype/dispatcher.cloud/src/...
Also, you did not mention if you are using AEM on Prem or AEMaaCS. Please refer to the relevant Dispatcher documentation from Adobe. Both are well documented.
Good luck,
Daniel
But in which file exactly do I add this snippet of code:
# Add Forwarded-Host header RequestHeader set Forwarded-Host "%{HTTP_HOST}e"
I can't modify the default.vhost file, because if I modify it the pipeline gives an error.
The files I have are:
dispatcher > src > conf.d > enabled_vhosts > default.vhost
dispatcher > src > conf.d > enabled_vhosts > custom_headers.conf
dispatcher > src > conf.d > available_vhosts > default.vhost
dispatcher > src > conf.d > rewrites > default_rewrite.rules
dispatcher > src > conf.d > rewrites > rewrite.rules
Views
Replies
Total Likes
Hello @daniel-strmecki
I am using AEM. So through the documentation I can create my own .vhost file, which would be in the following location:
dispatcher > src > conf.d > available_vhosts > default.vhost
However, I would have to specify that I created this file, so I would have to add this line of code:
../available_vhosts/default.vhost
in my file:
dispatcher > src > conf.d > enabled_vhosts > default.vhost
Correct ?
Views
Replies
Total Likes
Hi @EvertonSa2,
your own VHOST file has nothing todo with the default.vhost, just leave the default as is and configure your own. The right folder to place it is available_vhosts, but keep in mind you will have to create a symbolic link to it in the enabled_vhosts.
Good luck,
Daniel
Views
Likes
Replies
Views
Like
Replies
Views
Likes
Replies