• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved CORS stop to working using HTTP 2 Plesk Plesk Obsidian Version 18.0.52

PeopleInside

Regular Pleskian
Username:

TITLE

CORS stop to working using HTTP 2 Plesk Plesk Obsidian Version 18.0.52

PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE

Plesk Obsidian Version 18.0.52
Ubuntu 22.04.2 LTS

PROBLEM DESCRIPTION

After updating Plesk Obsidian Version 18.0.51 to Plesk Obsidian Version 18.0.52 I discovered that CORS that I have inserted in Additional Nigix directive for using HTTP 2 are no more working.

This directive has been added for made work the live chat widget (livehelperchat).

Plesk Staff helped me about this issue in the past here: Forwarded to devs - HTTP2 and CORS issues

Now I never had changed server, the live chat application is the same, even revert back database and files to a backup that work before live helper chat update never resolve the issue.

If I turn off HTTP 2 so Nigix the issue is resolved but my server never use HTTP 2

I know the correct CORE settings to insert because Plesk Staff has suggested it and was working until some week ago.
Server has not been changed, live helper chat has not been changed because even restore an old backup never made difference so it's not an issue from Live Helper Chat.

My question would be WHY CORES are no more working for Ngix HTTP 2 when the correct core works in Apache and was working on Ngix HTTP 2 too the last week?

I can think the issue is related to me if I changed something in the server but I don't.
  1. Server is the same
  2. Live Helper Chat has been also restored from an old backup but still not showing the widget
  3. Disabling Nigix resolve the issue but HTTP 2 is no more in use

STEPS TO REPRODUCE

In Ngix additional directive I have the code suggested:
See the code and a screenshot here

The live chat is installed at livechat.peopleinside.it
in this directory an .htaccess file redirect to the folder livechat

Nothing changed in this weeks just updated Plesk.
Now I'm asking why the CORS are no more working.

If works in Apache, if I followed also the documentation of the live helper chat app

why I'm unable to use HTTP 2 anymore because the widget chat is not showed?

2023-05-18_23-32-00

ACTUAL RESULT

After updating Plesk seems my live chat widget is no more visible.

I understand that someone can tell me I edited maybe the appplication but I did not.
I just upgraded live helper chat but also restoring an old backup (files and database) never work anymore.

Disabling HTTP 2 made all works so the issue is by Plesk side.
As HTTP 2 is no supported only by Apache but needs Nigix, could you help me to understand why this is not working?

I usually never ask for custom help in this forum, I try to discuss just issues I can have using Plesk, usually the forum are able to help with basic suggestion. In this case all was working and stopped and the issue seems to be not my chat application because restore an old working backup still never work.

EXPECTED RESULT

The CORS directive suggested also from the Plesk Staff should work as always do.
Why works in Apache but now are no more working on Additional Ngix directive?
All was working last week.

ANY ADDITIONAL INFORMATION

  1. I know the directive needed for made the live chat widget visible, they are described in the official app documentation here: Install Guide | Live Helper chat , those directive are working in Apache if I turn off HTTP 2 in Plesk so the issue come from the Nigix proxy.
  2. Additional directive I set in Additional Nigix directive should be correct as it has been suggested here by the team and seems respect what is in Apache. This has stopped to work after Plesk update.
Think about me:
- Server has not been changed, it is the same, the only update done was Plesk. I also updated live helper chat but restore all files and database of the application to a working backup never resolve so looks the issue is not in the chat application.
- Disabling HTTP 2 Ngix proxy resolve the issue so this made me think the issue comes from Ngix proxy. I'm sure settings are correct because I never changed. Even the live chat domain still be the same..

I really have no idea why this is causing issue and for this now I'm using the old HTTP 1 protocol.
I hope to figure out why CORS may stop to work.

Sadly Plesk need a proxy to have HTTP 2 this caused the issue in the past but after the help of the staff that explained how should be setup, now I should know how to avoid the past issue.. seems the CORS has stopped to work after some day ago update of Plesk.

YOUR EXPECTATIONS FROM PLESK SERVICE TEAM

Help with sorting out
 
This is a very important issue to me, I want ignore that because I want keep the server update and secure and use the latest available protocol HTTP 2.
I don't feel to ask custom support, I feel I'm asking support for a basic function that was working before and now is broken and that works if I deactivate HTTP 2 in Plesk.

Even a backup restoration of the app that is not working never help to resolve the issue so, the issue seems to be server related but I did not touch the server. I'm spending hours to understand this issue without any success.
 
I have just installed Live Helper Chat on a subdomain based on a server with Plesk 18.0.52#3 following the official Install Guide. Using the Nginx directives posted here I was able to get it working without any issues. I highly doubt your issue is caused by Plesk.

You stated the issue started after you updated LHC. So my first suggestion to double check if all read/write permissions for the directories mentioned in the install guide. Secondly check if you have configured Chat configuration -> Misc -> Domains where script can be embedded correctly. It should list your domain there.

If that doesn't help, you could try to turn off proxy mode for your subdomain livechat.peopleinside.it. That way Apache won't be used and your are solely using Nginx, which reduces the chance of conflicts between those two. If you turn off proxy mode you can use the following Nginx directives to allow for cross domain access:

Code:
location / {
    add_header Access-Control-Allow-Origin 'https://peopleinside.it';
    add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS, PUT, DELETE';
    add_header Access-Control-Allow-Headers 'Origin, X-Requested-With, Content-Type, Accept, API-Key, Authorization, X-Test';
}
Change the URL listed in the Allow-Origin header if your domain is different.

Hope this helps.
 
Last edited:
Thanks @Kaspar
You stated the issue started after you updated LHC.
I updated Plesk some day ago maybe also yesterdau then LHC.
When I discover the issue I restored fully the LHC backup so looks strange can be LHC.

About permission all seems works except HTTP 2 Nigix.

So my first suggestion to double check if all read/write permissions for the directories mentioned in the install guide. Secondly check if you have configured Chat configuration -> Misc -> Domains where script can be embedded correctly. It should list your domain there.
Thanks, I done this already, nothing has been changed and all looks fine.
I will see if disable proxy mode for your subdomain livechat.peopleinside.it helps to resolve with also the directive for Ngix.

I tried to turn off proxy mode but issue still be present in Ngix.
I dont know where add the Ngix directive.
 
/var/www/vhosts/system/livechat.peopleinside.it/conf/vhost_nginx.conf

Code:
location ~* ^/internal-nginx-static-location/(.+\.(gif|jpe?g?|png|bmp|swf|css|js|svg|otf|eot|ttf|woff|woff2|swf|mp3|ogg|wasm|wav|pdf|ico|txt))$ {
    alias /var/www/vhosts/peopleinside.it/httpdocs/subdomains/livechat.peopleinside.it/$1;
    internal;
    add_header Access-Control-Allow-Origin '*';
    add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS, PUT, DELETE';
    add_header Access-Control-Allow-Headers 'Origin, X-Requested-With, Content-Type, Accept, API-Key, Authorization, X-Test';
}

proxy_connect_timeout 180s;
proxy_send_timeout 180s;
proxy_read_timeout 180s;
fastcgi_send_timeout 180s;
fastcgi_read_timeout 180s;

This is the code that I have set in livechat.peopleinside.it Hosting & DNS tab > Apache & nginx Settings.
 
Can you first empty (remove) everything set in livechat.peopleinside.it Hosting & DNS tab > Apache & nginx Settings > Additional Nginx directives? Then save it when its empty and try again to add the Nginx directives from my previous post?
 
I done, I tried to clean, save and put the different code but same error.
Consider that in those day I never changed nothing in the server only updated Plesk and live helper chat.

Once I discovered the issue I asked help to the chat developer but when I discovered was no any issue in the laster chat app I restored the situation as previously of the chat update but issue was not resolved.

This looks be a big mistery to me because if the Poxy Nigix configuration was working before how can be broken by an update of the chat that never changed core and how can still be broken on full files and database restore of the application?

Apache take the CORS from .htaccess file and that is working if Ngix is disabled... so the issue seems to come from the Ngix proxy but how can be wrong the code I have that is the code I always used and was gived from the Plesk Staff?

I really don't understand.
 
As a workaround and a way to further trouble shoot the issue, can you setup a new subdomain (testing.peopleinsde.it for example) for testing purposes and freshly install LHC?
 
For today I think I will stop. I'm too much stressed, this HTTP 2 is really not working was all ok and a day after all broken without touching nothing.
Also I'm surprised there is no way to understand why is not working :D I need relax.
 
As a workaround and a way to further trouble shoot the issue, can you setup a new subdomain (testing.peopleinsde.it for example) for testing purposes and freshly install LHC?
I tried and on new subdomain test.peopleinside.it it works.
Now I have to understand why is not working on my side, on the original live chat that I use...
 
@Kaspar you helped in the final resolution.
Comparing Apache & Nigix settings page I found that on my not test domain the option Smart static files processing was checked.
I really don't remind to have checked this by muself, also the description on this option say to disable only for test so seems something active by default but on the test domain created was not active by default and this is what resolved, this option should be turned off.
 
As a workaround and a way to further trouble shoot the issue, can you setup a new subdomain (testing.peopleinsde.it for example) for testing purposes and freshly install LHC?
Hi! @Kaspar I have installed live helper chat on my Linux server and all is done good. But when i try to embed my code widget on any different domain I am having this error "Access to script at 'https://[redacted]/design/defaulttheme/js/widgetv2/index.js?2023510' from origin 'Paktaleem - Testing' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource." I have updated the code in .htaccess file and also done all according to this doc "Security | Live Helper chat".
Please help me to solve this issue that it is annoying me for last some days.
 
Last edited by a moderator:
Hi! @Kaspar I have installed live helper chat on my Linux server and all is done good. But when i try to embed my code widget on any different domain I am having this error "Access to script at 'https://[redacted]/design/defaulttheme/js/widgetv2/index.js?2023510' from origin 'Paktaleem - Testing' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource." I have updated the code in .htaccess file and also done all according to this doc "Security | Live Helper chat".
Please help me to solve this issue that it is annoying me for last some days.
Thanks for your question @Muhammad ali Muhammad .
If you try to install and use Live Helper Chat with Plesk you need special configuration on Plesk as Live Helper Chat cannot work correctly because Plesk use HTTP 2 using Apache and Nginx so this cause CORS issue if you don't add special server configuration.

Just following the Live Helper Chat guide never help if you are suing Plesk and HTTP 2.

Login into your Plesk panel, go on Domains then select the domain where Live Helper Chat is installed.
Click on Hosting and DNS tab, then Apache & nginx tab.
Here you should see:
Common Apache settings all set to default.
Restrict the ability to follow symbolic links option checked
Additional Apache directives I have nothing, empty
nginx settings, proxy mode active checked other options below not checked.
On Additional nginx directives you need add:

Code:
location ~* ^/internal-nginx-static-location/(.+\.(gif|jpe?g?|png|bmp|swf|css|js|svg|otf|eot|ttf|woff|woff2|swf|mp3|ogg|wasm|wav|pdf|ico|txt))$ {
    alias /var/www/vhosts/uouruser/httpdocs/livechat.domain.ext/livechat$1;
    internal;
    add_header Access-Control-Allow-Origin '*';
    add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS, PUT, DELETE';
    add_header Access-Control-Allow-Headers 'Origin, X-Requested-With, Content-Type, Accept, API-Key, Authorization, X-Test';
}

You will need to customize the path that in the code is:
Code:
/var/www/vhosts/uouruser/httpdocs/livechat.domain.ext/livechat
You can use the SSH to take the correct path or just FTPS

After apply if you insert the correct path and all suggested settings from Live Helper Chat guide the widget should work.
 
Back
Top