Answers.Body: <p>I'm not 100% sure this is the answer to your issue; but this <em>might</em> be the solution:</p>
  
  <p>Helge has written an article <a href="https://startingcraft.com/articles/how-to-use-ngrok-with-craftcms" rel="nofollow noreferrer">here</a> about using ngrok with Craft CMS (which I'd recommend looking over if you haven't already). In particular, he mentions he has the following lines in his Craft config particularly for logging into the CP over ngrok:</p>
  
  <pre><code>// Logging in to the CP will fail unless you turn off CSRF protection.
  'enableCsrfProtection' =&gt; false,
  </code></pre>
  
  <p>Try that config option and see if that fixes the issue for you...</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-01T20:19:35.687Z
Answers.Text: Thanks for the suggestion. I tried it out, and this does not fix it.
Answers.UserDisplayName: BBaysinger
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-01T21:03:38.130Z
Answers.Text: I found the note in your tutorial that says Craft needs unsecured to run admin on `valet share`. Is CSRF protection the only thing that needs addressed for that?
Answers.UserDisplayName: BBaysinger
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-02T12:27:36.730Z
Answers.Text: That actually has changed recently; thanks to [this PR](https://github.com/laravel/valet/pull/630) we can now share secured sites as easily as unsecured ones. Let me test one of my own sites and see if I can login over ngrok...
Answers.UserDisplayName: Jalen Davenport
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-08T22:41:09.640Z
Answers.Text: Thank you. Any luck on that?
Answers.UserDisplayName: BBaysinger
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-01T12:43:07.837Z
Answers.LastActivityDate: 2019-04-01T12:43:07.837Z
Answers.UserDisplayName: Jalen Davenport
Body: <p>I have a Craft instance running via Valet, per the instructions <a href="https://medium.com/@jalendport/running-craft-cms-3-on-laravel-valet-6df61e5193fd" rel="nofollow noreferrer">here</a>.</p>
  
  <p>Running the project via <code>valet link</code> works great, and <code>valet share</code> works, except when I try to access the admin side. I'm using <code>valet share</code> to try to access the site over a local network for a demo.</p>
  
  <p>In Chrome from <code>http://ad3f5068.ngrok.io/admin/login</code> when I try to log in, I get:</p>
  
  <pre><code>OPTIONS http://craftycoffee.test:60/index.php?p=admin/actions/users/login 404 (Not Found)
  Access to XMLHttpRequest at 'http://craftycoffee.test:60/index.php?p=admin/actions/users/login' from origin 'http://ad3f5068.ngrok.io' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
  </code></pre>
  
  <p>If I use HTTPS, I get net::ERR_SSL_PROTOCOL_ERROR across a bunch of requests.</p>
  
  <p>What am I missing to get this to share over a local host?</p>
  
Tags: <hosting><valet>
Title: valet share, ngrok giving 404, CORS errors
ThreadText: # valet share, ngrok giving 404, CORS errors
  
  (Asked by: username_0 on 2019-04-01)
  
  I have a Craft instance running via Valet, per the instructions [here](https://medium.com/@jalendport/running-craft-cms-3-on-laravel-valet-6df61e5193fd).
  
  Running the project via `valet link` works great, and `valet share` works, except when I try to access the admin side. I'm using `valet share` to try to access the site over a local network for a demo.
  
  In Chrome from `http://ad3f5068.ngrok.io/admin/login` when I try to log in, I get:
  
  ```
  OPTIONS http://craftycoffee.test:60/index.php?p=admin/actions/users/login 404 (Not Found)
  Access to XMLHttpRequest at 'http://craftycoffee.test:60/index.php?p=admin/actions/users/login' from origin 'http://ad3f5068.ngrok.io' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
  
  ```
  
  If I use HTTPS, I get net::ERR\_SSL\_PROTOCOL\_ERROR across a bunch of requests.
  
  What am I missing to get this to share over a local host?
  
  **Tags:** hosting, valet
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-04-01. Score: 2
  
  I'm not 100% sure this is the answer to your issue; but this *might* be the solution:
  
  Helge has written an article [here](https://startingcraft.com/articles/how-to-use-ngrok-with-craftcms) about using ngrok with Craft CMS (which I'd recommend looking over if you haven't already). In particular, he mentions he has the following lines in his Craft config particularly for logging into the CP over ngrok:
  
  ```
  // Logging in to the CP will fail unless you turn off CSRF protection.
  'enableCsrfProtection' => false,
  
  ```
  
  Try that config option and see if that fixes the issue for you...
  
  > **Comments:**
  > **username_0**: Thanks for the suggestion. I tried it out, and this does not fix it.  
  > **username_0**: I found the note in your tutorial that says Craft needs unsecured to run admin on `valet share`. Is CSRF protection the only thing that needs addressed for that?  
  > **username_1**: That actually has changed recently; thanks to [this PR](https://github.com/laravel/valet/pull/630) we can now share secured sites as easily as unsecured ones. Let me test one of my own sites and see if I can login over ngrok...  
  > **username_0**: Thank you. Any luck on that?  
  
  ---
  
  