Spree Engine/API Mounting Routes - spree

I am mounting spree at a "custom" location, like so:
mount Spree::Core::Engine, :at => '/shop'
This works fine for the main portion of the site, but API calls in the admin side get 404ed.
No route matches [GET] "/shop/api/orders/R373466857/shipments/H36171240358/ship.json"
I noticed that the API routes look like this:
ready_api_order_shipment_path PUT /api/orders/:order_id/shipments/:id/ready(.:format) spree/api/shipments#ready {:format=>"json"}
ship_api_order_shipment_path PUT /api/orders/:order_id/shipments/:id/ship(.:format) spree/api/shipments#ship {:format=>"json"}
add_api_order_shipment_path PUT /api/orders/:order_id/shipments/:id/add(.:format) spree/api/shipments#add {:format=>"json"}
remove_api_order_shipment_path PUT /api/orders/:order_id/shipments/:id/remove(.:format) spree/api/shipments#remove {:format=>"json"}
Notice the lack of /shop prepending the relevant routes. Any ideas? I can just redirect them in my HTTP server, but that seems like a godawful hack.

Your engine is being mounted correctly. In your rake routes you should see something like this:
1| Prefix Verb URI Pattern Controller#Action
2| spree /shop Spree::Core::Engine
3|
4| Routes for Spree::Core::Engine:
5| new_spree_user_session GET /user/spree_user/sign_in(.:format) spree/user_sessions#new
All of the spree routes are mounted under /shop as shown by line 2 above. The Routes for Spree::Core::Engine section lists the routes relative to the path the engine is mounted under. It's a bit confusing, but that's the way rake routes works.
I believe that you're having problems because you're trying to do a GET request to a route which only accepts PUT requests. If you switch your HTTP request type, you should get things to resolve correctly.

Related

Nuxt SSG app not routing correctly on google cloud bucket, goes to dir/index.html on reload

I followed this tutorial on how to host server side generated sites on Google Cloud Buckets. The issue I am having is that the nuxt app works fine when routing internally, but when I reload a route, the site is redirected to whatever route plus a /index.html at the end.
This causes things to break, as it conflicts with Nuxt routing. I set index to be my entry point ala
gsutil web set -m index.html -e 404.html gs://my-static-assets
but it seems to assume that to be the case always. I don't have this problem using Netlify.
According to the tutorial that you're doing, you're redirected to /route/index.html because of your MainPageSuffix index, this means that when you try to access for example https://example.com/route the service look for the target https:// example.com/route/index.html.
To fix this I suggest that you include an index.html file under the subdirectory in the subdirectory of the route.
I recommend, for further info on this to check this post which has a similar issue.

Sitecore API issue

I am currently getting 404 error for “API/sitecore/{controller}/{action}” calls in delivery server (after Hardening) but the same was working fine on authoring environment in sitecore. Please help
It sounds like routing configuration is different for these server. There are 2 typical places, where this configuration is done:
Check and compare your configuration of initialize pipelines on both
servers: I guess on CD is absent configuration that is respond for
this route "API/sitecore/{controller}/{action}".
Compare your Global.asax files on both servers.
The other reason could be in some additional configurations on CD server, e.g.: URL rewrite, HTTP redirect.
#Vikram Devasenapathy Please register your controller route in route config.
Are you using forms with ajax postback?
This issues was fixed by registering the routes in global asas file.

Redirects for Ember app on shared hosting (hostgator)

I have an ember app that I have been building. It has several routes including index (/) and authorization (/authorization). My trouble is that when the application is hosted on hostgator, loading the url myapp.com/authorization results in a 404. This makes sense since there is nothing at that actual url. I need hostgator to redirect all non-file-specific urls to my index.html file.
An example in psuedo code:
if url has extension (.jpg, .pdf, etc)
serve requested url
else
serve index.html but retain url in the address bar
I've done this sort of thing with local instances of node when using AngularJs with ui-router, but this is my first time using History-API based routing served from HostGator.
Any suggestions on where to start to set this up?
Not much of an answer but you can use locationType: 'hash' in environment.js as your configuration.
With locationType set to 'auto', refreshing on application hosted on Hostgator will produce a 404. I have encountered this before and not found any solution. So I switched to 'hash'.
If you find any solution, please tell me. Thanks!

Codeignitere route regex 404

I'm trying to make dynamic route for user pages. My route config looks next:
$route['id[0-9+]'] = 'user/index/$1';
On my Mac with MAMP it works fine. I can access to user's page with next uri (for example):
http://localhost:8888/MySite/id1
But the same uri doesn't work on the server and on my partner's windows-machine. I can access to page with user/index/1 and all another static routes works fine. I think there is a problem with regular expression, but I can't figure out what the problem is.
'id[0-9]+'
I guess you mean this.This will match id87 or id67723.
id[0-9+] will match id9+ or id8 or id+

Attempting to access SOAP Service from Silverlight App, clientaccesspolicy.xml, crossdomain.xml

I am getting the dreaded "attempting to access a service in a cross-domain way without a proper cross-domain policy in place" error when attempting to call a soap service. When I look at fiddler, it says
2| 404 | HTTP | THIS.ISTHEURLTOTHESERVICE.COM | /clientaccesspolicy.xml |
I am trying to understand, does this mean the I am missing the clientaccesspolicy.xml file or that the server hosting the service is missing this file? I have tried adding it to my project in many different places, also added it to c://inetpub/wwwroot but still getting the error.
Any ideas?
EDIT: Also I am running from localhost.
This indicates that the clientaccesspolicy.xml file isn't getting served from the URL that you see in Fiddler. It's possible that you haven't configured IIS to serve XML files; when you haven't done that IIS will return a 404 when asked to serve such a file.