/api/sitecore is not working in CD serverWeb API 2 Attribute Routing with Sitecore 8.2 Initial ReleaseSitecore 8.2 - Best way to expose sitecore data to external system as web apiWeb API 404 on content delivery serverDo we have an API for sitecore 6.6Sitecore JSS integrated mode with subsitesloading partial view from jquerySitecore WebApi custom route not working controller not foundServicesApiController in referenced project/DLLWeb Api on Content Delivery server returns unexpected JSON response with __interceptorsSitecore custom api routing is not working

What's the maximum time an interrupt service routine can take to execute on atmega328p?

SOLVED - GFCI - should my neutral and ground have continuity?

What does "it kind of works out" mean?

When did the Roman Empire fall according to contemporaries?

Why are Hobbits so fond of mushrooms?

Is there any word for "disobedience to God"?

As the Dungeon Master, how do I handle a player that insists on a specific class when I already know that choice will cause issues?

How do Windows version numbers work?

If your plane is out-of-control, why does military training instruct releasing the joystick to neutralize controls?

Managing and organizing the massively increased number of classes after switching to SOLID?

How to achieve this rough borders and stippled illustration look?

Is purchasing foreign currency before going abroad a losing proposition?

What's the minimum number of sensors for a hobby GPS waypoint-following UAV?

Can I play a first turn Simic Growth Chamber to have 3 mana available in the second turn?

Can fluent English speakers distinguish “steel”, “still” and “steal”?

Why was hardware diversification an asset for the IBM PC ecosystem?

Is an acid a salt or not?

Supporting developers who insist on using their pet language

Is Arc Length always irrational between two rational points?

How can one write good dialogue in a story without sounding wooden?

Why do people keep referring to Leia as Princess Leia, even after the destruction of Alderaan?

Get ids only where one id is null and other isn't

How were Martello towers supposed to work?

Why do players in the past play much longer tournaments than today's top players?



/api/sitecore is not working in CD server


Web API 2 Attribute Routing with Sitecore 8.2 Initial ReleaseSitecore 8.2 - Best way to expose sitecore data to external system as web apiWeb API 404 on content delivery serverDo we have an API for sitecore 6.6Sitecore JSS integrated mode with subsitesloading partial view from jquerySitecore WebApi custom route not working controller not foundServicesApiController in referenced project/DLLWeb Api on Content Delivery server returns unexpected JSON response with __interceptorsSitecore custom api routing is not working






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















Sitecore Version: 9.0.2



Environment: Azure PaaS CD



We are trying to call /api/sitecore/controller/actionname with AJAX. It's working on the CM server but not on the CD server.



I disabled custom errors and removed HTTP error configuration in web.config, but it still redirects to the custom 404 page I've created.










share|improve this question






























    1















    Sitecore Version: 9.0.2



    Environment: Azure PaaS CD



    We are trying to call /api/sitecore/controller/actionname with AJAX. It's working on the CM server but not on the CD server.



    I disabled custom errors and removed HTTP error configuration in web.config, but it still redirects to the custom 404 page I've created.










    share|improve this question


























      1












      1








      1








      Sitecore Version: 9.0.2



      Environment: Azure PaaS CD



      We are trying to call /api/sitecore/controller/actionname with AJAX. It's working on the CM server but not on the CD server.



      I disabled custom errors and removed HTTP error configuration in web.config, but it still redirects to the custom 404 page I've created.










      share|improve this question
















      Sitecore Version: 9.0.2



      Environment: Azure PaaS CD



      We are trying to call /api/sitecore/controller/actionname with AJAX. It's working on the CM server but not on the CD server.



      I disabled custom errors and removed HTTP error configuration in web.config, but it still redirects to the custom 404 page I've created.







      webapi






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 3 at 20:41









      Dan Sinclair

      3,0612 gold badges8 silver badges30 bronze badges




      3,0612 gold badges8 silver badges30 bronze badges










      asked Jul 3 at 17:45









      Siva KumarSiva Kumar

      4653 silver badges18 bronze badges




      4653 silver badges18 bronze badges




















          3 Answers
          3






          active

          oldest

          votes


















          4














          It was moved to SPEAK routes in Sitecore 9 and unavailable on CD server. You can resolve it by adding this snippet to your routing configuration (if you really need this API route - best practice is to create your own routes for your API calls):



          if (ConfigurationManager.AppSettings["role:define"] == "ContentDelivery")

          RouteTable.Routes.MapRoute("Sitecore.Speak.Commands", "api/sitecore/controller/action");






          share|improve this answer
































            4














            The /sitecore/api route is a default route added by Sitecore in configs that are specific to the content management aspects of the platform. These configs are not enabled for content delivery. As noted in x3mxray's answer, they can be reenabled, but I wouldn't recommend it.



            Instead of reenabling the default routes for other functionality you (probably) don't need on your CD servers, I would recommend mapping a custom route to your method and not relying on the /api/sitecore prefix.



            1. Create pipeline processor to register route



            using System.Web.Mvc;
            using System.Web.Routing;
            using Sitecore.Pipelines;

            public class RegisterWebApiRoutes

            public virtual void Process(PipelineArgs args)

            RouteTable.Routes.MapRoute("CustomApiRoute",
            "api/customaction",
            new controller = "ControllerName", action = "ActionName" ,
            new httpMethod = new HttpMethodConstraint("GET")
            );




            2. Create patch config to patch in your pipeline processor



            <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
            <sitecore role:require="Standalone OR ContentManagement OR ContentDelivery">
            <pipelines>
            <initialize>
            <processor type="Custom.Pipelines.Initialize.RegisterWebApiRoutes,Custom" patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc']"/>
            </initialize>
            </pipelines>
            </sitecore>
            </configuration>


            3. Update your code to reference this new route



            Don't forget to update your code to use the new route!






            share|improve this answer




















            • 1





              your answer is reasonable and obvious. but question is not how to implement your cusom route, question is why "/api/sitecore is not working in CD server"

              – x3mxray
              Jul 4 at 0:19











            • In my opinion, both answers are missing the mark. This answer is more accurate because it offers a path forward that is more of a best practice and explained well. While @x3mxray's answer is short and answers the immediate question, it offers a hack that shouldn't actually be done. That is why I upvoted this answer.

              – Pete Navarra
              Jul 4 at 1:06












            • @x3mxray - I added a blurb at the beginning of my answer to hopefully more directly answer the question.

              – Dan Sinclair
              Jul 5 at 12:07






            • 1





              @petenavarra - I added a blurb at the beginning of my answer to hopefully more directly answer the question.

              – Dan Sinclair
              Jul 5 at 12:07


















            0














            I have experienced the same issue on a project which had a custom pipeline for 404 redirects. Can you look for a similar code in your .config files from CD server?



            <pipelines>
            <httpRequestBegin>
            <processor type="MyCustomDLL.NotFoundHttpRequestProcessor, MyCustomDLL"
            patch:after="processor[@type='Sitecore.Pipelines.HttpRequest.ItemResolver, Sitecore.Kernel']">
            </processor>
            </httpRequestBegin>
            </pipelines>


            404 response is hard-coded on the pipeline:



            HttpContext.Current.Response.StatusCode = 404;
            HttpContext.Current.Response.TrySkipIisCustomErrors = true;
            HttpContext.Current.Response.StatusDescription = "404 File Not Found";


            If that is your case, a possible solution would be checking which URL is being requested in your custom pipeline.
            e.g.:



            if (args.RequestUrl.LocalPath.StartsWith("/api/sitecore", StringComparison.InvariantCultureIgnoreCase))

            return;






            share|improve this answer

























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "664"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsitecore.stackexchange.com%2fquestions%2f19716%2fapi-sitecore-is-not-working-in-cd-server%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              4














              It was moved to SPEAK routes in Sitecore 9 and unavailable on CD server. You can resolve it by adding this snippet to your routing configuration (if you really need this API route - best practice is to create your own routes for your API calls):



              if (ConfigurationManager.AppSettings["role:define"] == "ContentDelivery")

              RouteTable.Routes.MapRoute("Sitecore.Speak.Commands", "api/sitecore/controller/action");






              share|improve this answer





























                4














                It was moved to SPEAK routes in Sitecore 9 and unavailable on CD server. You can resolve it by adding this snippet to your routing configuration (if you really need this API route - best practice is to create your own routes for your API calls):



                if (ConfigurationManager.AppSettings["role:define"] == "ContentDelivery")

                RouteTable.Routes.MapRoute("Sitecore.Speak.Commands", "api/sitecore/controller/action");






                share|improve this answer



























                  4












                  4








                  4







                  It was moved to SPEAK routes in Sitecore 9 and unavailable on CD server. You can resolve it by adding this snippet to your routing configuration (if you really need this API route - best practice is to create your own routes for your API calls):



                  if (ConfigurationManager.AppSettings["role:define"] == "ContentDelivery")

                  RouteTable.Routes.MapRoute("Sitecore.Speak.Commands", "api/sitecore/controller/action");






                  share|improve this answer















                  It was moved to SPEAK routes in Sitecore 9 and unavailable on CD server. You can resolve it by adding this snippet to your routing configuration (if you really need this API route - best practice is to create your own routes for your API calls):



                  if (ConfigurationManager.AppSettings["role:define"] == "ContentDelivery")

                  RouteTable.Routes.MapRoute("Sitecore.Speak.Commands", "api/sitecore/controller/action");







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jul 3 at 23:48

























                  answered Jul 3 at 18:04









                  x3mxrayx3mxray

                  1,1422 silver badges18 bronze badges




                  1,1422 silver badges18 bronze badges























                      4














                      The /sitecore/api route is a default route added by Sitecore in configs that are specific to the content management aspects of the platform. These configs are not enabled for content delivery. As noted in x3mxray's answer, they can be reenabled, but I wouldn't recommend it.



                      Instead of reenabling the default routes for other functionality you (probably) don't need on your CD servers, I would recommend mapping a custom route to your method and not relying on the /api/sitecore prefix.



                      1. Create pipeline processor to register route



                      using System.Web.Mvc;
                      using System.Web.Routing;
                      using Sitecore.Pipelines;

                      public class RegisterWebApiRoutes

                      public virtual void Process(PipelineArgs args)

                      RouteTable.Routes.MapRoute("CustomApiRoute",
                      "api/customaction",
                      new controller = "ControllerName", action = "ActionName" ,
                      new httpMethod = new HttpMethodConstraint("GET")
                      );




                      2. Create patch config to patch in your pipeline processor



                      <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
                      <sitecore role:require="Standalone OR ContentManagement OR ContentDelivery">
                      <pipelines>
                      <initialize>
                      <processor type="Custom.Pipelines.Initialize.RegisterWebApiRoutes,Custom" patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc']"/>
                      </initialize>
                      </pipelines>
                      </sitecore>
                      </configuration>


                      3. Update your code to reference this new route



                      Don't forget to update your code to use the new route!






                      share|improve this answer




















                      • 1





                        your answer is reasonable and obvious. but question is not how to implement your cusom route, question is why "/api/sitecore is not working in CD server"

                        – x3mxray
                        Jul 4 at 0:19











                      • In my opinion, both answers are missing the mark. This answer is more accurate because it offers a path forward that is more of a best practice and explained well. While @x3mxray's answer is short and answers the immediate question, it offers a hack that shouldn't actually be done. That is why I upvoted this answer.

                        – Pete Navarra
                        Jul 4 at 1:06












                      • @x3mxray - I added a blurb at the beginning of my answer to hopefully more directly answer the question.

                        – Dan Sinclair
                        Jul 5 at 12:07






                      • 1





                        @petenavarra - I added a blurb at the beginning of my answer to hopefully more directly answer the question.

                        – Dan Sinclair
                        Jul 5 at 12:07















                      4














                      The /sitecore/api route is a default route added by Sitecore in configs that are specific to the content management aspects of the platform. These configs are not enabled for content delivery. As noted in x3mxray's answer, they can be reenabled, but I wouldn't recommend it.



                      Instead of reenabling the default routes for other functionality you (probably) don't need on your CD servers, I would recommend mapping a custom route to your method and not relying on the /api/sitecore prefix.



                      1. Create pipeline processor to register route



                      using System.Web.Mvc;
                      using System.Web.Routing;
                      using Sitecore.Pipelines;

                      public class RegisterWebApiRoutes

                      public virtual void Process(PipelineArgs args)

                      RouteTable.Routes.MapRoute("CustomApiRoute",
                      "api/customaction",
                      new controller = "ControllerName", action = "ActionName" ,
                      new httpMethod = new HttpMethodConstraint("GET")
                      );




                      2. Create patch config to patch in your pipeline processor



                      <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
                      <sitecore role:require="Standalone OR ContentManagement OR ContentDelivery">
                      <pipelines>
                      <initialize>
                      <processor type="Custom.Pipelines.Initialize.RegisterWebApiRoutes,Custom" patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc']"/>
                      </initialize>
                      </pipelines>
                      </sitecore>
                      </configuration>


                      3. Update your code to reference this new route



                      Don't forget to update your code to use the new route!






                      share|improve this answer




















                      • 1





                        your answer is reasonable and obvious. but question is not how to implement your cusom route, question is why "/api/sitecore is not working in CD server"

                        – x3mxray
                        Jul 4 at 0:19











                      • In my opinion, both answers are missing the mark. This answer is more accurate because it offers a path forward that is more of a best practice and explained well. While @x3mxray's answer is short and answers the immediate question, it offers a hack that shouldn't actually be done. That is why I upvoted this answer.

                        – Pete Navarra
                        Jul 4 at 1:06












                      • @x3mxray - I added a blurb at the beginning of my answer to hopefully more directly answer the question.

                        – Dan Sinclair
                        Jul 5 at 12:07






                      • 1





                        @petenavarra - I added a blurb at the beginning of my answer to hopefully more directly answer the question.

                        – Dan Sinclair
                        Jul 5 at 12:07













                      4












                      4








                      4







                      The /sitecore/api route is a default route added by Sitecore in configs that are specific to the content management aspects of the platform. These configs are not enabled for content delivery. As noted in x3mxray's answer, they can be reenabled, but I wouldn't recommend it.



                      Instead of reenabling the default routes for other functionality you (probably) don't need on your CD servers, I would recommend mapping a custom route to your method and not relying on the /api/sitecore prefix.



                      1. Create pipeline processor to register route



                      using System.Web.Mvc;
                      using System.Web.Routing;
                      using Sitecore.Pipelines;

                      public class RegisterWebApiRoutes

                      public virtual void Process(PipelineArgs args)

                      RouteTable.Routes.MapRoute("CustomApiRoute",
                      "api/customaction",
                      new controller = "ControllerName", action = "ActionName" ,
                      new httpMethod = new HttpMethodConstraint("GET")
                      );




                      2. Create patch config to patch in your pipeline processor



                      <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
                      <sitecore role:require="Standalone OR ContentManagement OR ContentDelivery">
                      <pipelines>
                      <initialize>
                      <processor type="Custom.Pipelines.Initialize.RegisterWebApiRoutes,Custom" patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc']"/>
                      </initialize>
                      </pipelines>
                      </sitecore>
                      </configuration>


                      3. Update your code to reference this new route



                      Don't forget to update your code to use the new route!






                      share|improve this answer















                      The /sitecore/api route is a default route added by Sitecore in configs that are specific to the content management aspects of the platform. These configs are not enabled for content delivery. As noted in x3mxray's answer, they can be reenabled, but I wouldn't recommend it.



                      Instead of reenabling the default routes for other functionality you (probably) don't need on your CD servers, I would recommend mapping a custom route to your method and not relying on the /api/sitecore prefix.



                      1. Create pipeline processor to register route



                      using System.Web.Mvc;
                      using System.Web.Routing;
                      using Sitecore.Pipelines;

                      public class RegisterWebApiRoutes

                      public virtual void Process(PipelineArgs args)

                      RouteTable.Routes.MapRoute("CustomApiRoute",
                      "api/customaction",
                      new controller = "ControllerName", action = "ActionName" ,
                      new httpMethod = new HttpMethodConstraint("GET")
                      );




                      2. Create patch config to patch in your pipeline processor



                      <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
                      <sitecore role:require="Standalone OR ContentManagement OR ContentDelivery">
                      <pipelines>
                      <initialize>
                      <processor type="Custom.Pipelines.Initialize.RegisterWebApiRoutes,Custom" patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc']"/>
                      </initialize>
                      </pipelines>
                      </sitecore>
                      </configuration>


                      3. Update your code to reference this new route



                      Don't forget to update your code to use the new route!







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jul 5 at 12:07

























                      answered Jul 3 at 20:39









                      Dan SinclairDan Sinclair

                      3,0612 gold badges8 silver badges30 bronze badges




                      3,0612 gold badges8 silver badges30 bronze badges







                      • 1





                        your answer is reasonable and obvious. but question is not how to implement your cusom route, question is why "/api/sitecore is not working in CD server"

                        – x3mxray
                        Jul 4 at 0:19











                      • In my opinion, both answers are missing the mark. This answer is more accurate because it offers a path forward that is more of a best practice and explained well. While @x3mxray's answer is short and answers the immediate question, it offers a hack that shouldn't actually be done. That is why I upvoted this answer.

                        – Pete Navarra
                        Jul 4 at 1:06












                      • @x3mxray - I added a blurb at the beginning of my answer to hopefully more directly answer the question.

                        – Dan Sinclair
                        Jul 5 at 12:07






                      • 1





                        @petenavarra - I added a blurb at the beginning of my answer to hopefully more directly answer the question.

                        – Dan Sinclair
                        Jul 5 at 12:07












                      • 1





                        your answer is reasonable and obvious. but question is not how to implement your cusom route, question is why "/api/sitecore is not working in CD server"

                        – x3mxray
                        Jul 4 at 0:19











                      • In my opinion, both answers are missing the mark. This answer is more accurate because it offers a path forward that is more of a best practice and explained well. While @x3mxray's answer is short and answers the immediate question, it offers a hack that shouldn't actually be done. That is why I upvoted this answer.

                        – Pete Navarra
                        Jul 4 at 1:06












                      • @x3mxray - I added a blurb at the beginning of my answer to hopefully more directly answer the question.

                        – Dan Sinclair
                        Jul 5 at 12:07






                      • 1





                        @petenavarra - I added a blurb at the beginning of my answer to hopefully more directly answer the question.

                        – Dan Sinclair
                        Jul 5 at 12:07







                      1




                      1





                      your answer is reasonable and obvious. but question is not how to implement your cusom route, question is why "/api/sitecore is not working in CD server"

                      – x3mxray
                      Jul 4 at 0:19





                      your answer is reasonable and obvious. but question is not how to implement your cusom route, question is why "/api/sitecore is not working in CD server"

                      – x3mxray
                      Jul 4 at 0:19













                      In my opinion, both answers are missing the mark. This answer is more accurate because it offers a path forward that is more of a best practice and explained well. While @x3mxray's answer is short and answers the immediate question, it offers a hack that shouldn't actually be done. That is why I upvoted this answer.

                      – Pete Navarra
                      Jul 4 at 1:06






                      In my opinion, both answers are missing the mark. This answer is more accurate because it offers a path forward that is more of a best practice and explained well. While @x3mxray's answer is short and answers the immediate question, it offers a hack that shouldn't actually be done. That is why I upvoted this answer.

                      – Pete Navarra
                      Jul 4 at 1:06














                      @x3mxray - I added a blurb at the beginning of my answer to hopefully more directly answer the question.

                      – Dan Sinclair
                      Jul 5 at 12:07





                      @x3mxray - I added a blurb at the beginning of my answer to hopefully more directly answer the question.

                      – Dan Sinclair
                      Jul 5 at 12:07




                      1




                      1





                      @petenavarra - I added a blurb at the beginning of my answer to hopefully more directly answer the question.

                      – Dan Sinclair
                      Jul 5 at 12:07





                      @petenavarra - I added a blurb at the beginning of my answer to hopefully more directly answer the question.

                      – Dan Sinclair
                      Jul 5 at 12:07











                      0














                      I have experienced the same issue on a project which had a custom pipeline for 404 redirects. Can you look for a similar code in your .config files from CD server?



                      <pipelines>
                      <httpRequestBegin>
                      <processor type="MyCustomDLL.NotFoundHttpRequestProcessor, MyCustomDLL"
                      patch:after="processor[@type='Sitecore.Pipelines.HttpRequest.ItemResolver, Sitecore.Kernel']">
                      </processor>
                      </httpRequestBegin>
                      </pipelines>


                      404 response is hard-coded on the pipeline:



                      HttpContext.Current.Response.StatusCode = 404;
                      HttpContext.Current.Response.TrySkipIisCustomErrors = true;
                      HttpContext.Current.Response.StatusDescription = "404 File Not Found";


                      If that is your case, a possible solution would be checking which URL is being requested in your custom pipeline.
                      e.g.:



                      if (args.RequestUrl.LocalPath.StartsWith("/api/sitecore", StringComparison.InvariantCultureIgnoreCase))

                      return;






                      share|improve this answer



























                        0














                        I have experienced the same issue on a project which had a custom pipeline for 404 redirects. Can you look for a similar code in your .config files from CD server?



                        <pipelines>
                        <httpRequestBegin>
                        <processor type="MyCustomDLL.NotFoundHttpRequestProcessor, MyCustomDLL"
                        patch:after="processor[@type='Sitecore.Pipelines.HttpRequest.ItemResolver, Sitecore.Kernel']">
                        </processor>
                        </httpRequestBegin>
                        </pipelines>


                        404 response is hard-coded on the pipeline:



                        HttpContext.Current.Response.StatusCode = 404;
                        HttpContext.Current.Response.TrySkipIisCustomErrors = true;
                        HttpContext.Current.Response.StatusDescription = "404 File Not Found";


                        If that is your case, a possible solution would be checking which URL is being requested in your custom pipeline.
                        e.g.:



                        if (args.RequestUrl.LocalPath.StartsWith("/api/sitecore", StringComparison.InvariantCultureIgnoreCase))

                        return;






                        share|improve this answer

























                          0












                          0








                          0







                          I have experienced the same issue on a project which had a custom pipeline for 404 redirects. Can you look for a similar code in your .config files from CD server?



                          <pipelines>
                          <httpRequestBegin>
                          <processor type="MyCustomDLL.NotFoundHttpRequestProcessor, MyCustomDLL"
                          patch:after="processor[@type='Sitecore.Pipelines.HttpRequest.ItemResolver, Sitecore.Kernel']">
                          </processor>
                          </httpRequestBegin>
                          </pipelines>


                          404 response is hard-coded on the pipeline:



                          HttpContext.Current.Response.StatusCode = 404;
                          HttpContext.Current.Response.TrySkipIisCustomErrors = true;
                          HttpContext.Current.Response.StatusDescription = "404 File Not Found";


                          If that is your case, a possible solution would be checking which URL is being requested in your custom pipeline.
                          e.g.:



                          if (args.RequestUrl.LocalPath.StartsWith("/api/sitecore", StringComparison.InvariantCultureIgnoreCase))

                          return;






                          share|improve this answer













                          I have experienced the same issue on a project which had a custom pipeline for 404 redirects. Can you look for a similar code in your .config files from CD server?



                          <pipelines>
                          <httpRequestBegin>
                          <processor type="MyCustomDLL.NotFoundHttpRequestProcessor, MyCustomDLL"
                          patch:after="processor[@type='Sitecore.Pipelines.HttpRequest.ItemResolver, Sitecore.Kernel']">
                          </processor>
                          </httpRequestBegin>
                          </pipelines>


                          404 response is hard-coded on the pipeline:



                          HttpContext.Current.Response.StatusCode = 404;
                          HttpContext.Current.Response.TrySkipIisCustomErrors = true;
                          HttpContext.Current.Response.StatusDescription = "404 File Not Found";


                          If that is your case, a possible solution would be checking which URL is being requested in your custom pipeline.
                          e.g.:



                          if (args.RequestUrl.LocalPath.StartsWith("/api/sitecore", StringComparison.InvariantCultureIgnoreCase))

                          return;







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jul 6 at 15:30









                          Leonardo FaggianiLeonardo Faggiani

                          485 bronze badges




                          485 bronze badges



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Sitecore Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsitecore.stackexchange.com%2fquestions%2f19716%2fapi-sitecore-is-not-working-in-cd-server%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

                              Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                              Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form