Query: I wn complete seperate .css/.scss and .html template file for my webcomponent.js like in angular. But with complete security. In lit. Use any js lib like domPurify, etc. But I wan complete safety. How? ChatGPT said: Thought for 16s Totally doable. Here’s a secure Lit setup with fully separate .html + .scss files , sanitized with DOMPurify , and rendered into the Shadow DOM without sacrificing performance. Folder layout src / lib/ safe- html .js components/ app-shell .html app-shell .scss app-shell .js 1) Install deps npm i dompurify npm i -D sass Vite will compile .scss . We’ll import the compiled CSS as text and attach it via adoptedStyleSheets (fast + memory-friendly). 2) app-shell.html (pure template file) Put your Carbon UI Shell markup here (no scripts). Example stub: < cds-header aria-label = "My App" > < cds-header-name prefix = "IBM" >[Platform] </ cds-header-name > < cds-header-glo...
How to Add Self-Signed SSL Certificate in Java Apache Tomee / Tomcat Server and then launch your site in Compute Engine?
Assumptions:
- You already have Linux / Debian Compute Engine installed in your Google Cloud Plateform (GCP) with Java installed in the system.
- You have Downloaded and Installed your required version of Tomee / Tomcat Server and installed this in your Compute Engine
- You have an active external IP Address for your Compute Engine
Prodecure:
1. Set $JAVA_HOME path as your java home directory.
2. Set $CATALINA_BASE path as your Tomee / Tomcat server base directory
3. Type Command in terminal: $JAVA_HOME/bin/keytool -genkey -alias <tomcat> -keyalg RSA
Enter details as asked for like password, your details, etc
4. Type Command: sudo nano $CATALINA_BASE/conf/server.xml
Add following line in your server<!-- Define an SSL Coyote HTTP/1.1 Connector on port 8443 --><Connectorprotocol="org.apache.coyote.http11.Http11NioProtocol"port="8443" maxThreads="200"scheme="https" secure="true" SSLEnabled="true"keystoreFile="${user.home}/.keystore" keystorePass="changeit"clientAuth="false" sslProtocol="TLS"/>
5. Activate TCP Port Number 8443 in your Compute Engine
6. Restart Tomee / Tomcat Server
7. Type command: curl https://localhost:8443
To see the outcome
Or visit in Browser <Your Compute Engine IP Address:8443>
8. Now, in browser, since in https:// it is a self signed certificate, it will show unsafe, back to safety, but you can do proceed with unsafe.
Note: This is more safer than http:// but is giving warning because certificate is my self signed generated using keytool in java bin folder and is not yet certified by any Certifying Autority, hence warning
Work Done
Comments
Post a Comment
If you have any doubts, please let me know.