{"id":887,"date":"2026-10-02T11:47:50","date_gmt":"2026-10-02T11:47:50","guid":{"rendered":"https:\/\/robinplomp.com\/?p=887"},"modified":"2026-10-02T11:47:50","modified_gmt":"2026-10-02T11:47:50","slug":"nsx-session-cookie-creation-fails-with-http-403-when-using-special-characters","status":"publish","type":"post","link":"https:\/\/robinplomp.com\/?p=887","title":{"rendered":"NSX Session Cookie Creation fails with HTTP 403 when using special characters"},"content":{"rendered":"<p style=\"-ms-word-break: normal; overflow-wrap: normal; hyphens: none;\">\n<p><img loading=\"lazy\" decoding=\"async\" width=\"123\" height=\"123\" align=\"left\" style=\"float: left; display: inline;\" alt=\"VMware Cloud Foundation 9.1 - Path For Dell VxRail Customers - VMware Cloud  Foundation (VCF) Blog\" src=\"https:\/\/blogs.vmware.com\/cloud-foundation\/wp-content\/uploads\/sites\/75\/2026\/05\/VCF-9.1-VCF-Operations_f6fab1-e1781629697273.png?w=150&amp;h=150&amp;crop=1\"> For a customer we are required to perform a STIG hardening check.More info about the STIG hardening for Broadcom can be found here: <a title=\"https:\/\/www.cyber.mil\/stigs\/downloads\" href=\"https:\/\/www.cyber.mil\/stigs\/downloads\">https:\/\/www.cyber.mil\/stigs\/downloads<\/a><\/p>\n<p><\/p>\n<p>To perform these test (they can be done for all components within VCF in one check, or check the components seperatly) on NSX you need to obtain a cookie ID and a token. Once you collected these items, you need to enter these into a yaml file and execute the test. In the documentation can be found to find these items you need to execute the following command:<br \/><em>curl -k -i -X POST -d &#8216;j_username=myuser&amp;j_password=mypassword&#8217; <a href=\"https:\/\/&lt;NSX-Manager&gt;\/api\/session\/create\">https:\/\/&lt;NSX-Manager&gt;\/api\/session\/create<\/a><\/em><\/p>\n<p>In my environement I receive the following error message:<br \/><strong>http\/1.1 403 Forbidden <\/strong><\/p>\n<p>This error is caused by the fact that special characters are being used in the password causing problems with the encoding.<\/p>\n<p>To resolve this issue we need to encode the <em>username<\/em> and <em>password <\/em>separatly, using <strong>&#8211;data-urlencode.<\/p>\n<p><\/strong>Example:<br \/><code>curl -i -k -c cookies.txt -X POST --data-urlencode 'j_username=&lt;username&gt;' --data-urlencode 'j_password=&lt;password&gt;' https:\/\/&lt;NSX-Manager&gt;\/api\/session\/create<\/code><\/p>\n<p><strong>Note:<\/strong> Replace <code>&lt;NSX-Manager&gt;,<\/code> <code>&lt;username&gt;<\/code> and <code>&lt;password&gt;<\/code> with the correct details.<\/p>\n<p>Now the command completes succesfull and you can collect the required data.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For a customer we are required to perform a STIG hardening check.More info about the STIG hardening for Broadcom can be found here: https:\/\/www.cyber.mil\/stigs\/downloads To perform these test (they can be done for all components within VCF in one check, or check the components seperatly) on NSX you need to obtain a cookie ID and &hellip; <a href=\"https:\/\/robinplomp.com\/?p=887\" class=\"more-link\">Lees verder <span class=\"screen-reader-text\">NSX Session Cookie Creation fails with HTTP 403 when using special characters<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39,88,79,22],"tags":[],"class_list":["post-887","post","type-post","status-publish","format-standard","hentry","category-nsx-t","category-stig","category-vcf","category-vmware"],"_links":{"self":[{"href":"https:\/\/robinplomp.com\/index.php?rest_route=\/wp\/v2\/posts\/887","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/robinplomp.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/robinplomp.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/robinplomp.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/robinplomp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=887"}],"version-history":[{"count":1,"href":"https:\/\/robinplomp.com\/index.php?rest_route=\/wp\/v2\/posts\/887\/revisions"}],"predecessor-version":[{"id":888,"href":"https:\/\/robinplomp.com\/index.php?rest_route=\/wp\/v2\/posts\/887\/revisions\/888"}],"wp:attachment":[{"href":"https:\/\/robinplomp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=887"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/robinplomp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=887"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/robinplomp.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}