En estos días que asusta leer la palabra cookie en cualquier sitio. Si nos remontamos al siglo pasado, los navegadores solían preguntarnos cada vez que iban a a definir una cookie para ver si aceptábamos o no. Cosa que se terminó volviendo insostenible ya que los sitios web definían varias cookies y empotraban contenido de otros sitios que querían definir cookies y terminábamos con unas diez ventanas emergentes cada vez que entrábamos en una web. Así que, bloqueabas todas, pero las webs no funcionaban bien, y terminabas resignándote y aceptando todo.
Aunque hoy vamos a tratar un tema diferente, vamos a darles a las cookies una utilidad extra. Aunque bien podemos conseguir el mismo efecto con un lenguaje de aplicación (Java, PHP, Python, etc), vamos a hacer que sea el mismo servidor web, en este caso Apache el que aplique una redirección en función del valor que tenga una cookie que nos manda el usuario y, un paso más, que sea transparente para él.
Tabla de contenidos
¿Para qué queremos esto?
Podemos utilizar esta técnica para tests A/B, para probar dos versiones de la web. Aunque vamonos a un caso extremo, pero real. Imaginemos que tenemos una versión antigua de la web, programada con versiones antiguas de un lenguaje de programación y también una versión nueva programada con versiones nuevas, bibliotecas nuevas, etc, de modo que esas dos versiones no pueden estar en la misma máquina (física o virtual), de modo que tendríamos que acceder a un punto de entrada nuevo y diferente.
También podemos hacer un acceso a un entorno de pruebas de la web, de modo que los desarrolladores puedan entrar a él, o incluso el cliente final, mientras no impedimos el acceso a los usuarios a la plataforma, haciendo que, el código sea diferente, las bases de datos sean diferentes, incluso las posibilidades de cargarnos algo también. Muchos desarrollos pueden estar pensadas para realizar pruebas, pero pensemos en plataformas como WordPress, que por unas cosas o por otras, en las que no voy a entrar, si cambiamos el host, con muchos plugins o temas podemos tener problemas.
Y, ¿qué tal el dar una seguridad extra a nuestras aplicaciones? De forma que solo alguien que tenga la cookie pueda entrar en un área privada en donde podrá trastear con muchas cosas peligrosas de su servidor adicionalmente a tener usuario y contraseña.
En muchos casos seguro que nos puede ser útil hacer una redirección en función de la dirección IP desde la que viene la petición, aunque en otros casos, tanto por el número de equipos que tienen que tener acceso como por el hecho de tener IPs dinámicas, no es posible.
Vamos a ver Apache
Para lograr esto, entramos en el VirtualHost de Apache y escribimos lo siguiente:
1 2 3 4 5 6 | ProxyPreserveHost On RewriteEngine On RewriteCond %{HTTP_COOKIE} nombre_de_cookie=([^;]+) RewriteCond %1 ^valor_de_cookie$ RewriteRule ^/(.*) http://otro_host/$1 [P,L] |
En este caso, con la directiva P para conectar vía proxy y L para que no se procesen más reglas de reescritura tras esta. Es necesario también tener los módulos rewrite y mod_proxy_http instalados por lo que antes de nada no está de más ejecutar:
Veamos un ejemplo completo, podemos ver este archivo de VirtualHost (lo he puesto todo en HTTP, en el mundo real deberíamos utilizar todos HTTPs):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | <VirtualHost *:80> ServerName miweb.com ServerAlias www.miweb.com ServerAdmin security@miweb.com DocumentRoot /var/www/miweb.com/www ProxyPreserveHost On RewriteEngine On RewriteCond %{HTTP_COOKIE} magicCookie=([^;]+) RewriteCond %1 ^123456$ RewriteRule ^/(.*) http://10.0.1.198/$1 [P,L] <Directory /var/www/miweb.com/www/ > Options -Indexes +FollowSymLinks +MultiViews AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> |
En este caso, cuando entra un visitante normal, entrará directamente a la web alojada en este servidor. Web que está en /var/www/miweb.com/www, pero si viene un visitante que tenga la cookie magicCookie establecida y cuyo valor sea 123456, internamente la petición se redirigirá al 10.0.1.198, que es una IP privada que está en la misma red que el servidor y a la que normalmente los usuarios no tendrían acceso. Esta nueva dirección puede pertenecer a una máquina de la misma red, una máquina conectada a Internet, máquinas virtuales o incluso contenedores docker.
Vamos a probarlo
Para realizar pruebas, podemos crear un pequeño programa que defina la cookie en cuestión, por ejemplo, en PHP podríamos hacer algo así:
1 2 3 |
Solo tenemos que llamar a este archivo php desde el navegador y cuando volvamos a nuestro dominio se realizará la redirección interna.
También podemos utilizar una extensión de Chrome o Chromium llamada Cookie Inspector. Solo tenemos que activar las herramientas para desarrolladores y nos dejará establecer y modificar cookies.
Foto principal: unsplash-logoLouis Reed
Hola, me parece interesante este tema pero que utilidades prácticas le podemos dar? ayuda a mejorar el pagespeed de google? podemos usarlo para cumplir con la ley de cookies sin usar js ?
We absolutely love your blog and find almost all of your post’s to be just what I’m looking for. Does one offer guest writers to write content for you personally? I wouldn’t mind publishing a post or elaborating on a number of the subjects you write with regards to here. p168 slot
Excellent blog! I found it while surfing around on Google. Content of this page is unique as well as well researched. Appreciate it. amc stocktwits
Thank goodness I discovered the information on Bing. https://www.md88.biz/
I’ve been searching everywhere for this! banker99-plus
I really appreciate this post. vision-system
At Packaging Papa, we offer a wide range of Custom Boxes With Logo printing options. We have various sizes and shapes available to suit your needs. Our quality print service will ensure that your logo stands out from the crowd and helps you promote your business effectively. If you are looking for a cost-effective way to promote your brand, then our custom packaging boxes are just what you need.
slotxo auto Thank you a bunch for sharing this with all of us you actually realize what you are talking about! Bookmarked. Please also seek advice from my site =). We could have a hyperlink change contract between us.
Magnificent blog! I tracked down it while riding around on Google. Content of this page is exceptional as well also explored. Feel a debt of gratitude.http://devinsncj433.theburnward.com/15-tips-about-paid-advertising-strategy-from-industry-experts
I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept. Thank you for the post. 바카라사이트
We get a lot of fun out of playing games on the internet. I take a break every hour to play run 3, an infinite runner that never gets boring.
Wow that was strange. I just wrote an very long comment but after I clicked submit my comment didn’t show up. Grrrr… well I’m not writing all that over again. Regardless, just wanted to say excellent blog! บาคาร่า
Hello, I’m interested in this concept, but what practical applications can we give it? Help Google increase page speed? Can we use it without JavaScript to comply with cookie law?
Here you can get complete information about jobs in Pakistan in complete detail. How you can apply for those jobs with complete instructions. balochistan public service commission
Might it be said that you are pondering where to shop for some tasteful and stylish clothing? IZ Retail shop has the right assortment for you. An enormous assortment of entrancing plans in Pakistani design. It is possible that you need a lovely salwar kameez or a rich maxi. pakistani clothes online usa
This blog is further than my expectations. Nice work guys!!! Lean Portfolio Management
I appreciate you sharing your wise knowledge with me. Your website is excellent. Your website contains an incredible amount of information. tree service Coventry
I became up until now started out getting some site, online people today manufacture listed here has provided absolutely everyone hugely. Have fun here ideal for your complete present-day period & give good results. fencing contractors albury
This is really a nice and informative, containing all information and also has a great impact on the new technology. Thanks for sharing it 다음드
This was very informative. Thank you for sharing.
this article really informative thanks for sharing it, you can read more article like this
Abogado Trafico Virginia Beach Va
Here You can get complete information about world’s best mobile network lycamobile. lyca bundles codes
this is so wonderful. i would like to avail the bundles. airbnb cleaning north miami can give complete information.
if you want read the article like
How to Get Reckless Driving Off Your Record in Virginia
if you want read the article like
How to Get a Reckless Driving Ticket Reduced in Virginia
if you want read the article like
How to Reduce a Reckless Driving Ticket in Virginia
I’ve been troubled for several days with this topic. keo nha cai, But by chance looking at your post solved my problem! I will leave my blog, so when would you like to visit it?
I’m not sure exactly why but this weblog is loading incredibly slow for me. Is anyone else having this problem or is it a problem on my end? I’ll check back later on and see if the problem still exists. https://casinonation.org/
Can we use it to comply with cookie law without using js?
Joy | drywall hanging
I think This is absolutely an insightful set up and it really is vitally powerful and educated. Subsequently, I would like to many thanks for that endeavors that you’ve developed in making this information. Each and every of the data is totally properly-investigated. Numerous thanks… บาคาร่าออนไลน์
Great articles and great layout. Your blog post deserves positive feedback custom boxes with logo
I’ve been troubled for several days with this topic. 카지노사이트, But by chance looking at your post solved my problem! I will leave my blog, so when would you like to visit it?
I’m writing on this topic these days, 카지노사이트추천 , but I have stopped writing because there is no reference material. Then I accidentally found your article. I can refer to a variety of materials, so I think the work I was preparing will work! Thank you for your efforts.
I haven’t any word to appreciate this post…..Really i am impressed from this post….the person who create this post it was a great human..thanks for shared this with us. weed blue dream
You have a well-structured blog here! How much time do they have?
No, I don’t think so.
You made blogging look easy.
The overall design of your site is fantastic, let alone the content
If you need someone to write for your blog, let me know.
I believe the messages you convey will have a big impact.
If you wish, I will gladly relieve you of some of your duties.
In exchange for a hyperlink to my blog, I will provide you with quality articles.
If you would like to contact us, please do so by email.
Thank you for your kind words!
This is a very well-written blog.
As a bonus, the page loads fast!
Can you send me the link to your hosting partner?
To be honest, I’d love it if your site loaded up as quickly as yours haha.
In light of some of the articles, I read on your site.
on the blog, you have a great writing style.
I added it to my list of favorite sites and plan to come back soon.
Check out my website to see what I’m working on.
So please let me know what you think about this matter.
I am really inspired with your writing abilities and also with the structure on your
blog. Is this a paid subject or did you modify it yourself?
Either way stay up the nice high quality writing, it’s
uncommon to see a nice blog like this one today..
You really make it seem so easy with your presentation but I find
this matter to be actually something which I think I would never understand.
It seems too complex and very broad for me.
I’m looking forward for your next post, I will try to
get the hang of it!
Really no matter if someone doesn’t be aware of after that its up to other users that they will help, so here it takes place 온라인카지노사이트.
dxhh
Hello, I read the post well. 온라인바카라 It’s a really interesting topic and it has helped me a lot. In fact, I also run a website with similar content to your posting. Please visit once
fhj
Thank you so much for such a well-written article. It’s full of insightful information. Your point of view is the best among many without fail.For certain,
Fentanyl Powder For Sale
Visit here
You have a well-structured blog here! How much time do they have?
No, I don’t think so.
You made blogging look easy.
The overall design of your site is fantastic, let alone the content
If you need someone to write for your blog, let me know.
I believe the messages you convey will have a big impact.
If you wish, I will gladly relieve you of some of your duties.
In exchange for a hyperlink to my blog, I will provide you with quality articles.
If you would like to contact us, please do so by email.
Thank you for your kind words!
This is a very well-written blog.
As a bonus, the page loads fast!
Can you send me the link to your hosting partner?
To be honest, I’d love it if your site loaded up as quickly as yours haha.
In light of some of the articles, I read on your site.
on the blog, you have a great writing style.
I added it to my list of favorite sites and plan to come back soon.
Check out my website to see what I’m working on.
So please let me know what you think about this matter.
This is a lot of useful and relevant information. it is in
I appreciate you taking the time to provide the rest of us with this valuable information.
Also, keep us posted.
Thank you for providing this information.
I am really inspired with your writing abilities and also with the structure on your
blog. Is this a paid subject or did you modify it yourself?
Either way stay up the nice high quality writing, it’s
uncommon to see a nice blog like this one today..
It’s difficult to acquire knowledgeable individuals about this topic, and you sound like what happens you’re speaking about! Thanks
UFA
What a post I’ve been looking for! I’m very happy to finally read this post. 온라인카지노 Thank you very much. Can I refer to your post on my website? Your post touched me a lot and helped me a lot. If you have any questions, please visit my site and read what kind of posts I am posting. I am sure it will be interesting.
This is the perfect post.바카라사이트 It helped me a lot. If you have time, I hope you come to my site and share your opinions. Have a nice day.
gj
Pretty great post. I just stumbled upon your weblog and wished to say
that I have really enjoyed browsing your weblog posts.
Very nice article and straight to the point.
I don’t know if this is truly the best place to ask but do you
folks have any idea where to get some professional writers? Thank you
Nice articles and also very helpful. Highly Appreciated! Thanks
I’m so happy to finally find a post with what I want. 바카라게임사이트 You have inspired me a lot. If you are satisfied, please visit my website and leave your feedback.
Great post. I was checking continuously this blog and I’m impressed!
Very useful information particularly the last part.Thank you and best of luck.
I was impressed by your writing. Your writing is impressive. I want to write like you.카지노게임추천 I hope you can read my post and let me know what to modify. My writing is in I would like you to visit my blog.
ทางเข้าสล็อต
Nice post. I believe many will love this blog. http://www.striveholistic.com
Your ideas have inspired me a lot. I want to learn your writing skills. There is also a website. Please visit us and leave your comments. Thank you. 온라인카지노
cfdhh
Great post very well written custom packaging boxes
I’m so happy to finally find a post with what I want. 바카라게임사이트 You have inspired me a lot. If you are satisfied, please visit my website and leave your feedback.
GFJ
This is truly fascinating and helpful information.
SAOMEI Backupper Professional Crack
I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details. Drywall Installations Vancouver
I’m not sure exactly why but this weblog is loading incredibly slow for me. Is anyone else having this problem or is it a problem on my end? I’ll check back later on and see if the problem still exists. 온라인바카라
CFHJH
I am extremely inspired with your writing talents and also with the structure on your blog.
EaseUS Data Recovery Wizard Crack
I’m so happy to finally find a post with what I want. 바카라게임사이트 You have inspired me a lot. If you are satisfied, please visit my website and leave your feedback.
GJJ
Useful post Thanks for sharing it that truly valuable knowledge about similar topic. Amazing. Have a more successful day.
Hotspot Shield Elite Crack
Thank you for sharing a bunch of this quality contents packaging box
You have performed a great job on this article custom packaging boxes
Thanks a lot very much for the high quality and results-oriented help. I have learned a lot from your site. Keep it up!
https://www.housecleaningchilliwack.ca/
Very Informative post. Will Read again Thanks!
Serato Studio Crack
Your article is what I’ve been looking for for a long time. I’m happy to find you like this. Could you visit my website if you have time? I’m sure you’ll find a post of interest that you’ll find interesting. ceiling repair
I’m not sure exactly why but this weblog is loading incredibly slow for me. Is anyone else having this problem or is it a problem on my end? I’ll check back later on and see if the problem still exists. 바카라사이트추천
I’ve been troubled for several days with this topic. 카지노사이트, But by chance looking at your post solved my problem! I will leave my blog, so when would you like to visit it?
Great comment, I really like this blog and will bookmark it. military rv rentals maryland
Thanks for the blog very nice keep going.vintage sweaters mens
I’ve been troubled for several days with this topic. slotsite, But by chance looking at your post solved my problem! I will leave my blog, so when would you like to visit it?
Nice Work. I Like Your Work And Appreciate You. It Helps Me In My Work. I visit every day some blogs and blogs to read articles. However, this weblog presents
feature-based writing. Woah! I’m enjoying the template/theme of
this website. It’s simple yet effective. A lot of times, it’s challenging to get that “perfect balance” between user friendliness and visual appeal.
I must say you’ve done an excellent job with this.
Nice Work. I Like Your Work And Appreciate You. It Helps Me In My Work. I visit every day some blogs and blogs to read articles. However, this weblog presents
feature-based writing. Woah! I’m enjoying the template/theme of
this website. It’s simple yet effective. A lot of times, it’s challenging to get that “perfect balance” between user friendliness and visual appeal.
I must say you’ve done an excellent job with this.
You have performed a great job on this article custom printed boxes
It’s the same topic , but I was quite surprised to see the opinions I didn’t think of. My blog also has articles on these topics, so I look forward to your visit. baccaratsite
The team at DrySeal Home and Basement Solutions is proud to be Virginia’s premier waterproofing company. We will gladly help protect your home or business with services such as crawl space encapsulation, basement waterproofing, mold Inspection and mold remediation Richmond Va residents can rely on. foundation repair lynchburg va
Los Angeles concrete contractors specialize in concrete resurfacing and concrete polishing. Call today for a free estimate and consult! 213 510 1217
concrete polishing los angeles
Portland Concrete Contractor is a name you can trust for beautiful decorative concrete. We work with clients in Portland and throughout the Pacific Northwest to provide superior products that stand apart from competitors’ services. (503) 461-8083 stamped concrete portland oregon
We’re a Concrete Contractor in Houston Texas that helps commercial and residential building owners finish their concrete structures with the perfect finish. Resurfacing, staining, and more! Contact us today for information or request a quote online! concrete staining houston
Denver Concrete Contractor and Stamped Concrete provide a safe and versatile surface that can be used for many purposes. Available in a variety of colors, textures, and styles which allow you to customize your patio to complement your home. Stamped concrete denver
Looking for the most reliable basement waterproofing Richmond Va and the surrounding areas has to offer? Dryseal Home and Basement Solutions is Virginia’s premier basement waterproofing, mold remediation and crawl space encapsulation company. If you are looking for waterproofing companies Lynchburg Va residents can trust then look no further.
Dryseal Home and Basement Solutions can give your crawlspace or basement a new aesthetic appeal while giving you a dry environment for storage. crawl space encapsulation richmond va
Welcome to Forest Tree Service Pros, Columbia MDs Premiere tree removal service company. We specialize in tree removal, tree trimming, and tree service. Call now and one of our tree experts will be happy to assist you. (410) 498-7867 tree removal columbia md
Welcome to Forest Tree Service Pros, your premier tree removal company in Parker, CO. We are dedicated to providing our clients with the highest quality tree removal services available, and our team of experienced arborists will ensure that your trees are removed quickly and safely. We understand that having trees removed can be a stressful experience, but we will do everything we can to make the process as smooth and hassle-free as possible. Contact us today to schedule a free consultation, and let us show you why we’re the best tree removal company in Parker!
We are the best tree removal service in Parker, Colorado? Look no further than Forest Tree Service Pros. We are a team of certified arborists with years of experience in tree removal and tree care. We have the knowledge and equipment to safely and efficiently remove any tree, regardless of size or location. We also offer stump removal and tree trimming services.
We take pride in our work and always put the safety of our customers and employees first. We are fully insured and offer free estimates. Call us today to schedule a consultation. tree removal parker co
Looking for the safest tree removal Savannah GA has to offer? Forest Tree Service Pros are the premier tree service in Savannah.
(912) 455-3348 tree removal savannah ga
Looking for the best tree removal and stump grinding services in Dallas, GA? Look no further than Forest Tree Service Pros! We are a locally owned and operated tree service company that has been serving the Dallas area for over 10 years. We are the experts in tree removal, stump grinding, and tree trimming, and we offer the most competitive rates in town. tree removal dallas ga
Looking for the best tree removal and stump grinding services in Dallas, GA? Look no further than Forest Tree Service Pros! We are a locally owned and operated tree service company that has been serving the Dallas area for over 10 years. We are the experts in tree removal, stump grinding, and tree trimming, and we offer the most competitive rates in town.
Don’t trust just anyone with your trees! Call the pros at Forest Tree Service today. We’ll be happy to provide you with a free estimate for any of our services. 678-771-6122
Tree Removal Stockton Ca
John N Eddie’s Tree Care the premier provider of comprehensive tree service in Stockton, Modesto, Lodi, and Manteca.
Our dedication is to quality, safety and customer service. Let us meet all of your tree care needs. Call today! (209) 479-0251
Tree Removal Stockton Ca
Looking for the best tree removal and stump grinding services in Dallas, GA? Look no further than Forest Tree Service Pros! We are a locally owned and operated tree service company that has been serving the Dallas area for over 10 years. We are the experts in tree removal, stump grinding, and tree trimming, and we offer the most competitive rates in town.
Don’t trust just anyone with your trees! Call the pros at Forest Tree Service today. We’ll be happy to provide you with a free estimate for any of our services. 678-771-6122 tree removal bakersfield ca
if you need an author for your website, please contact me.
I think I’d be a great addition to your team, based on the quality of your writings.
I’d be happy to write some stuff for your blog in return for a link back to mine if you ever need any help.
If you’re interested, please contact me via email. Regards!
I’d want to take this opportunity to thank you for the helpful advice I’ve received while reading your website.
We are eagerly anticipating the start of my college research, and this site has been an essential part of my pre-study preparations.
Please let me know if there is any way that what I have learnt here might be of use to anyone else.
I appreciate you providing yet another useful webpage. Exactly where else can I find knowledge stated in such a perfect manner?
I’ve been looking for information about this subject for a long time and yours truly has provided me with valuable information to work on.
if you need an author for your website, please contact me.
I think I’d be a great addition to your team, based on the quality of your writings.
I’d be happy to write some stuff for your blog in return for a link back to mine if you ever need any help.
If you’re interested, please contact me via email. Regards!
A big thanks to you for sharing this with everyone you know who may be interested in this subject matter.
My website is also available for your reference.
We might be able to work together on a link trade deal.
I was looking for another article by chance and found your article safetoto I am writing on this topic, so I think it will help a lot. I leave my blog address below. Please visit once.
I was impressed by your writing. Your writing is impressive. I want to write like you.카지노게임사이트 I hope you can read my post and let me know what to modify. My writing is in I would like you to visit my blog.
A big thanks to you for sharing this with everyone you know who may be interested in this subject matter.
lot of times, it’s challenging to get that “perfect balance” between user friendliness and visual appeal.
The information you shared is very accurate, it gives me the knowledge that I need to learn. Thank you for sharing this useful information.
I have been looking for articles on these topics for a long time. casinocommunity I don’t know how grateful you are for posting on this topic. Thank you for the numerous articles on this site, I will subscribe to those links in my bookmarks and visit them often. Have a nice day …
Making a website’s cookie request user friendly and not intimidating is really hard to do. Thank you for sharing this useful tutorial.
Thank you for posting this tutorial, it is easy to understand and very detailed.
Really jubilant to say, your post is exciting to read. I never stop myself to say something about it. You’re doing a great job
https://crackprosoft.net/blue-iris-crack/
“you have an eye for detail,” “you look at things in such interesting ways,”
and “I like the way you use lighting here.
Thanks to this place 1depositcasinouk people have fun and win
I appreciate the time and effort you put into writing this guide; it is clear and comprehensive. Thanks!
I really like the way that you have expressed yourself. There is a lot to be admired from this post. You might want to click onMontbell jacket oliver tree
This blog is really great. The information here will surely be of some help to me.
https://crackedlink.com/
I quite like looking through a post that will make men and women think. Also, many thanks for allowing for me to comment!
Removewat Activator Crack