I'd like to redirect users to /app/acme when their request is like this
http://our-internal-app or
http://our-internal-app/
If squid can intercept these requests, what would be the configuration for it?
I'd like to redirect users to /app/acme when their request is like this
http://our-internal-app or
http://our-internal-app/
If squid can intercept these requests, what would be the configuration for it?
I got it working
#!/usr/bin/python
import sys
import re
url_regex = re.compile(r'^http:\/\/our-internal-app(\/|\/index.html?)?$')
def rewrite_url(line):
""" If the input URL contains a port number, strip it out """
url_list = line.split(' ')
old_url = url_list[0]
new_url = '\n'
if url_regex.search(old_url):
new_url = 'http://our-internal-app/app/acme' + new_url
return new_url
while True:
line = sys.stdin.readline().strip()
new_url = rewrite_url(line)
sys.stdout.write(new_url)
sys.stdout.flush()
then on squid.conf, I added this
url_rewrite_program /etc/squid/redir.py
url_rewrite_children 5
Then I sent a HUP signal to our running squid to reload the config