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 ?
It looks like you’re discussing Apache and how to create redirects based on a cookie value. This can be useful for various purposes, including A/B testing, providing access to different versions of a website, or enhancing security.
You’ve provided a configuration example for Apache’s VirtualHost, demonstrating how to use Rewrite rules to achieve this redirection based on the cookie’s value. You’ve also mentioned testing methods using PHP or browser extensions like Cookie Inspector.
Overall, it’s a helpful guide for anyone interested in implementing such redirects with Apache. Thanks for sharing this information! Grand Rapids Remodeling Pros
Wow! Finally I got a website from where I be able to actually obtain helpful data regarding my study and knowledge.
betflix all
Thanks for posting this information. I just wanted to let you know that I just came across your website and I found it very interesting and informative happy wheels. I can’t wait to read more of your articles.
I can provide you with general instructions on how to log in to your MetaMask wallet. Please note that the user interface of MetaMask. Metamask extesnion ! metamask wallet login !Metamask login ! Download metamask wallet
I recommend visiting the official Coinbase website or checking the relevant app stores (such as the Chrome Web Store for browser extensions) for the latest updates and available extensions. Coinbase login ! Coinbase pro login !
Coinbase wallet extension
CoinMarketCap or have any account-related issues, I recommend visiting the official CoinMarketCap website and using their support or contact options. coinmarketcap signin
Wordle 2 is an updated version of the popular word puzzle game called «Wordle.» The word-guessing game challenges players to guess a hidden five-letter word within six attempts. Here’s how to play Wordle 2.
In today’s digital age, cryptocurrencies have become an integral part of our financial landscape. Whether you’re a seasoned investor or just starting your crypto journey, having a secure and user-friendly wallet is crucial. http://www.amazon.com/code
I have been looking at your articles and I think this is one of the most important pieces of information for me. I’m glad I read your article.먹튀신고
Are you tired of the same old yoga routines that leave you feeling uninspired and unmotivated? If so, it’s time to shake up your practice with the Yoga Burn Schedule. wellnesscomet.com
Beauycon Sports is thrilled to announce the launch of our exclusive line of custom tracksuits, designed to elevate your athletic performance and style.
Even if this article seems perfectly good, I think there are some missing points, but I am sure that you can find more by visiting 토토사이트 If my knowledge is not enough for you, please let me know.
Renascent Treatment Centre is a Canadian addiction treatment center that specializes in providing care and support for individuals. renascent treatment centre
You made some respectable factors there. I regarded on the web for the issue and found most people will associate with along with your posts.
Chilliwack Carpet Cleaners
The content of your article page, I find the content quite interesting and useful to me, thank you for sharing.
https://promocodc.net/
thanks for sharing this website https://wordlenytimes.net/
MetaMask Extension is a desktop-based browser extension that is currently supported by Google Chrome, Firefox, Edge, Brave, and Opera. It was initially launched by ConsenSys in 2016 and makes it easy for crypto enthusiasts to interact with a wide range of dApps (decentralized applications). It allows its users to buy, send, receive, swap, and bridge over 500,000 digital assets including all ETH-based tokens. Apart from all of this, it also allows its users to stake ETH and MATIC through its portfolio interface and lets them to earn a passive income.
In a world flooded with digital distractions, word puzzles have resurfaced as a source of both entertainment and intellectual stimulation. One particular word puzzle that has taken the internet by storm is the «NYT Wordle.» In this article, we’ll dive into the phenomenon that is NYT Wordle, explore its appeal, and unravel the secrets behind its addictive nature.
The Rise of NYT Wordle
NYT Wordle, short for New York Times Wordle, is an online word puzzle game that has gained immense popularity in recent times. It was first introduced by Jonathan Feinberg in 2008, but it experienced a resurgence in 2021, becoming a household name among word puzzle enthusiasts.
Here you will get all the information regarding to celebrities and their net worth and some good quality trending news. networthxi.com
After reading this write-up, I honestly think this excellent website needs a lot more consideration. I return frequently to learn more, thank you for this information. 메이저사이트
The reason why I was impressed after reading this article is because of good work and useful thoughts. I want to say thank you to the writer and I hope you come safely! I’d like to be with you all the time. Your energy is refreshing.. 안전메이저놀이터
Pretty nice post. I just stumbled upon your weblog and wanted to say that I have really enjoyed browsing your blog posts. After all I’ll be subscribing to your feed and I hope you write again soon!
My website: online sabong international
On a computer or mobile device, open a web browser and go to the official YouTube activation website, which is usually yt.be/activate. Please ensure you are using the official website. On the activation website, you will be prompted to enter the code displayed on your TV screen. Once you’ve entered the code, follow the on-screen instructions to complete the activation process. After successful activation, your YouTube account should be linked to your device, and you should be able to access YouTube content on your TV or other device.
I came to this site with the introduction of a friend around me and I was very impressed when I found your writing.igobdcom I\’ll come back often after bookmarking! casinocommunity
Wow I didn’t knew that blow dryer can make this much big difference. I will forward this blog to my girlfriend and ask her to do the same hair as in the first picture.
Para crear redirecciones en Apache en función de una cookie, puedes utilizar la directiva RewriteCond para comprobar la existencia o el valor de la cookie y luego usar RewriteRule para realizar la redirección. Aquí tienes un ejemplo de cómo hacerlo en un archivo de configuración de Apache:
musics web
Nyt Wordle is a popular word game that has taken the globe by storm. It’s a fun and addictive way to test your vocabulary skills and challenge yourself with word puzzles. But what exactly is New York Times Wordle Today? In simple terms, Nyt Wordle is an online game where players try to guess a five-letter target word within six tries. Each time you make a guess, the game provides feedback on which letters are correct and in the right position or if any letters are correct but in the wrong position. The beauty of Nyt Wordle lies in its simplicity. You don’t need complicated rules or instructions to get started. Just open up the website or app, and you’re ready to begin guessing words! The interface is clean and user-friendly, making it accessible for players of all ages.
Nyt Wordle
Great article Lot’s of information to Read…Great Man Keep Posting and update to People..Thanks
Wow I didn’t knew that blow dryer can make this much big difference. I will forward this blog to my girlfriend and ask her to do the same hair as in the first picture.
Morse Code | Invention, History, & Systems
Morse Code, either of two systems for representing letters of the alphabet, numerals, and punctuation marks by an arrangement of dots, ..
Really love these kind of blogs. skip hire
KEep it up! Really good. car recovery leeds
I’ve noticed that you’re genuinely interested in this type of! We’re looking to construct our own ring website, and you’ve made it easier by adding useful statistics. Parging Vancouver
Do you want to show yourself in the street with our vlone now? Taking your friends to buy our cheap handbags now.vlone has been cut down 50% discount now, without shipping fee.
I’m certainly partaking in your site. You certainly have some incredible knowledge and extraordinary stories.
I’ve noticed that you’re genuinely interested in this type of! We’re looking to construct our own ring website, and you’ve made it easier by adding useful statistics. credit repair lenexa
Love this blog so much! breakdown recovery luton
We can’t push enough, the meaning of variety while choosing a men’s sheepskin plane coat, you might want to have or a see you might want to go for. leather bomber jackets for men
Lovely stuff! Thanks a lot for this! sandblasting
I think this is an instructional post and it is very beneficial and knowledgeable. I am very happy to read this substance. I think this is an enlightening post and it is very useful and knowledgeable. Thank you for your discuss. 먹튀사이트
Many developments may be designed for testing, but let’s think about drywall r and platforms like WordPress, which for one reason or another, which I’m not going to go into, if we change the host, with many plugins or themes we can have problems.
Good effort! Nottingham Car Recovery
Love love this! pavers
Nice blog! vehicle recovery near me
Loving this so much! car recovery near me
Muha Meds is a popular brand in the cannabis industry, known for its high-quality and reliable products. With an extensive range of cannabis vape cartridges, Muha Meds has gained a reputation for delivering a consistent and enjoyable vaping experience.
Muha disposable
Wow! Absolutely outstanding work here.
I must give the author credit for creating such a well-written post.
It kept my attention throughout, and I believe its concepts will be helpful to its readers.
The article’s structure is something I particularly appreciate.
An intriguing prologue set the stage for the rest of the story.
The major body of the text offered a wealth of information, with supporting research and several examples that simplified complex topics.
After reading the conclusion, which effectively summed up the entire paper, I felt satisfied and motivated to study more.
The writing was also of exceptionally high quality.
The author has remarkable command of the English language, wit, and the ability to communicate intricate ideas.
The most intricate details were explained in a way that even a layperson could understand.
Each sentence has been meticulously crafted to keep the reader interested and informed.
In addition, the author’s knowledge is impressive in both its range and depth.
I appreciate that the author has used credible sources and references to back up any claims they have made in the work.
You can tell right away that the author is passionate about the topic and has done extensive research.
Finally, I’d like to express my gratitude for everyone’s insightful comments and advice.
This post helped me to gain a deeper understanding of the subject at hand and to pick up some practical pointers that I may put to use in the future.
This piece is unusual in that it is both insightful and practical.
I’d want to send the author my most heartfelt thanks for creating such a wonderful piece of literature.
It’s obvious that you worked hard on this piece because you want to help people, and for that I thank you.
Keep up the fantastic effort, and I look forward to reading more of your fantastic articles in the future!
Nice site! car recovery liverpool
https://fareedfreepc.com/wise-care-365-pro-for-reviews/
NYT Wordle is a word-guessing game that challenges players to guess a five-letter word within a limited number of attempts. It combines wordplay, deduction, and logic to provide an engaging and addictive gaming experience.
Play New York Times Wordle and Find Today’s Wordle Answer at https://www.nyt-wordle.com
Muha Meds is a popular brand in the cannabis industry, known for its high-quality and reliable products. With an extensive range of cannabis vape cartridges, Muha Meds has gained a reputation for delivering a consistent and enjoyable vaping experience.
Muha meds carts
I like every performance you do for it. I believe you will create a very useful place. I’m also very happy. Good performance!토토사이트추천
In today’s digital age, streaming services have revolutionized the way we consume entertainment. HBO Max, one of the leading platforms, offers a vast library of premium content. To enjoy HBO Max on your TV, you need to sign in. This article will guide you through the process of signing in to HBO Max on your television, ensuring you can access all the fantastic shows and movies.
hbomax/tvsignin
I have been shopping on Temu for a couple of months now. I am really satisfied with the variety of products and affordable pricing. Previously I had been a regular customer of Shein too. So, people ask me to do a Temu vs Shein comparison which can help them make informed decisions.
Discover the powerful assignment features in Google Classroom that streamline your teaching process. Learn how to create, grade, and manage assignments effectively for a seamless classroom experience.
Learn how to create, grade, and manage assignments effectively for a seamless classroom experience.
NYT Wordle is a popular online word puzzle game. In the game, players try to guess a five-letter word within six attempts. After each guess, the letters in the guessed word are color-coded to provide feedback. Wordle Nyt is an enhanced version of the classic game that was featured in The New York Times Wordle.
how to remove reckless driving from record in virginia Removing a reckless driving charge from your record in Virginia can be challenging. Consult with a legal professional to explore options like expungement or record-sealing, based on individual circumstances.
RootsMagic Serial Key is by all accounts a steady family parentage developer who can save and coordinate a ton of data, including commitment commemorations. Considering different local area information, this equivalent PC system offers laid-out and flexible subcategories. It has five specific segments, and, surprisingly, a navigational toolbar.
https://validsoftlinks.com/rootsmagic-crack-activation-key-latest-version-2023/
Thanks for one’s marvelous posting! I actually enjoyed reading it, you may be a great author. I will ensure that I bookmark your blog and will often come back very soon. I want to encourage you continue your great writing, have a nice day! ufa168
NYT Wordle is a popular online word puzzle game that challenges players to guess a five-letter word within six attempts. Players submit their guesses, and the game provides feedback by coloring the letters to indicate if they are correct, misplaced, or not in the target word. It’s a simple yet addictive game that has gained a cult following and is featured in The New York Times, making it a daily word puzzle sensation enjoyed by word enthusiasts around the world.
Quardle is a word puzzle game inspired by the popular online game Wordle. In Quordle, players attempt to guess four five-letter words simultaneously. After each guess, the game provides feedback on the correctness of the guessed words by highlighting correct letters in green, incorrect letters in yellow, and misplaced letters in gray
Ny Wordle is a word-guessing game where players attempt to guess a secret five-letter word within six or fewer attempts. Wordle Ny provides feedback by highlighting correct letters in green, letters that are correct but in the wrong position in yellow, and incorrect letters in gray. The objective is to deduce the correct word through a process of elimination and strategic guessing.
Good day! This is my first visit to your blog! We are a team of volunteers and starting a new initiative in a community in the same niche. Your blog provided us beneficial information to work on. You have done a extraordinary job! ufabet
It’s actually a nice and helpful piece of info. I’m happy that you shared this helpful information with us. Please stay us up to date like this.Thank’s for sharing.
Here is My Homepage: rugby betting
Waffle Game is a virtual gaming experience that combines the joy of waffle appreciation with immersive gameplay. It’s not just about flipping waffles; it’s about navigating through a world filled with syrupy challenges and delightful surprises.
NYT Wordle is an online game that challenges players to guess a five-letter word within six attempts. Each guess is met with color-coded feedback: green for correct letters in the right position, yellow for correct letters in the wrong position, and gray for incorrect letters. The objective is to decode the hidden word using these clues. play NYT Wordle and Improve Your Vocabulary.
NYTimes Wordle is an updated version of the popular word puzzle game called «Wordle.» The word-guessing game challenges players to guess a hidden five-letter word within six attempts. Here’s how to play NYTimes Wordle.
ufa789 หมดยุคบ่อนบนดิน รวยได้จริงแค่เล่นออนไลน์
It’s actually a nice and helpful piece of info. I’m happy that you shared this helpful information with us. Please stay us up to date like this.Thank’s for sharing.
Here is My Homepage:live casino games online
Thanks for sharing informative post. It is one of the best site that I have visited. Hope you will share more quality blog posts thank you.
Carmy The Bear Jacket
This is excellent article, thank you for the share! This is what I am looking for, hope in future you will continue sharing such an superb work.
Elon Musk Jacket