Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


How to use Nginx MAP for changing html code based on cookie?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

How to use Nginx MAP for changing html code based on cookie?

RoldanRoldan Member
edited August 2021 in Help

I have this nginx map now, but it doesn't work.

map $http_cookie $loggeduser {
     default    'img/logo_guest.png';
    ~site_user    'img/logo_user.png';
    ~site_logged_in     'img/logo_user.png';
}

sub_filter 'img src="/img/'     'img src="cdn.site.com/$loggeduser';

Comments

  • any reason behind this? Why don’t put the logic on your backend instead of on web server?

    It’s really easy to bypass

    Thanked by 1webcraft
  • SplitIceSplitIce Member, Host Rep

    Do you need to use sub_filter? It's probably better to do the job properly and to do it either on your backend or if you can't in javascript.

Sign In or Register to comment.