crisp-im / crisp-sdk-ios

:package: Crisp iOS SDK, add a chat in any iOS app and communicate with your users.
https://docs.crisp.chat/guides/chatbox-sdks/ios-sdk/
Other
45 stars 19 forks source link

Support for reverse proxy for crisp #96

Closed henrychan-osl closed 3 months ago

henrychan-osl commented 4 months ago

Pre request of business we have implemented the reverse proxy from https://help.crisp.chat/en/article/how-can-i-add-my-helpdesk-behind-a-reverse-proxy-ar5km0/

We add it in the nginx like this

$server_name =

`location /support/ { proxy_pass https:///en/; proxy_http_version 1.1;

    proxy_ssl_server_name on;

    proxy_set_header Accept-Encoding "";
    proxy_set_header Access-Control-Allow-Origin "*";

    sub_filter 'href="https://$server_name/' 'href="https://$server_name/';

    sub_filter 'action="https://<crisp custom domain>/en/' 'action="https://$server_name/support/';

    sub_filter 'href="https://<crisp custom domain>/en/' 'href="https://$server_name/support/';
    sub_filter 'href="https://<crisp custom domain>/zh/' 'href="https://$server_name/zh-Hans/support/';
    sub_filter 'href="https://<crisp custom domain>/zh-hk/' 'href="https://$server_name/zh-Hant/support/';

    sub_filter 'hreflang="zh"' 'hreflang="zh-Hans"';
    sub_filter 'hreflang="zh-hk"' 'hreflang="zh-Hant"';

    sub_filter 'href="/en/' 'href="/support/';
    sub_filter 'href="/zh/' 'href="/zh-Hans/support/';
    sub_filter 'href="/zh-hk/' 'href="/zh-Hant/support/';
    sub_filter 'action="/en/' 'action="/support/';

    sub_filter_once off;
}`

you can see I like to change the /en/ to /support/, /zh/ to /zh-Hans/support/  and /zh-hk/ to /zh-Hant/support/

it is actually implemented in osl.com/support/.

I used this library from our app as well. yet once we use the chatbot in library. it is using pointing to https:///article/ instead of https:///article/ and it leads to 404 error.

I like to understand how to fix the issue from library level instead of adding a 301 from https:///article/ to https:///support/article/. (that's what we did to temporary fix it)

eliottvincent commented 3 months ago

Not related to iOS SDK, closing.

henrychan-osl commented 3 months ago

your SDK use the wrong path. how it is not related to SDK. what is it related to?

eliottvincent commented 3 months ago

Our iOS SDK will use your regular helpdesk domain. There is no way to specify another URL.