cedaro / satispress

Expose installed WordPress plugins and themes as Composer packages.
500 stars 48 forks source link

HTTP/2 404 on composer require, but not composer install #193

Closed adam-vanbuskirk closed 1 year ago

adam-vanbuskirk commented 1 year ago

Hello, I don't think this is an issue, but I'm not sure where to ask for help so figured I would start here. We've been using this plugin 1.0.3 for several months without issue. Today, I went to do a composer require on a few new plugin versions, and I'm now getting the below error:

[Composer\Downloader\TransportException]
The "{insert our private package server url here}/satispress/packages.json" file could not be downloaded (HTTP/2 404 )

Oddly enough composer install doesn't throw the error and installs the packages just fine. My question, where is the packages.json file located in the file structure? I'm guessing it is not missing, but that I have some communication error happening with the basic http auth (I know my credentials are correct). So my first step is I want to physically look for the json file to see if it is there and rule out it somehow getting deleted.

thanks, Adam

bradyvercher commented 1 year ago

HI Adam, there isn't a physical packages.json file on the server anywhere, so you won't find that. Instead a rewrite rule is registered to serve the dynamically generated content when https://example.com/satispress/packages.json is requested.

Some hosts/servers don't route URLs with a file extension (.json in this case) through WordPress, so a 404 might be served in that case. The documentation has a bit of information regarding that.

  1. First, make sure the rewrite rule is being generated and actually exists.
  2. Check the https://example.com/satispress/packages.json URL in a browser and see what loads.
  3. If you're on nginx, you may need to manually add a rewrite rule.

When I originally developed this, I did some testing on WP Engine and that's when I discovered that some hosts wouldn't route URLs with file extensions through WordPress. SatisPress will automatically add an external rule in .htaccess to account for this, but I haven't tested with their new Web Rules Engine since they deprecated .htaccess support. If you're on WP Engine that might be something to look into as well.

adam-vanbuskirk commented 1 year ago

Thanks so much for the reply! In case it ever helps someone else, I had our package server set to nginx + apache with the rewrite rule you mentioned but our hosting company changed it to nginx (why without talking to us is beyond me). Since nginx can't do rewrites, it was throwing the 404. We changed back to nginx + apache and it started immediately working. Thanks again for the fast reply! Adam

On Wed, Oct 26, 2022 at 5:08 PM Brady Vercher @.***> wrote:

HI Adam, there isn't a physical packages.json file on the server anywhere, so you won't find that. Instead a rewrite rule is registered to serve the dynamically generated content when https://example.com/satispress/packages.json is requested.

Some hosts/servers don't route URLs with a file extension (.json in this case) through WordPress, so a 404 might be served in that case. The documentation https://github.com/cedaro/satispress/blob/develop/docs/troubleshooting.md#rewrite-rules has a bit of information regarding that.

  1. First, make sure the rewrite rule is being generated and actually exists.
  2. Check the https://example.com/satispress/packages.json URL in a browser and see what loads.
  3. If you're on nginx, you may need to manually add a rewrite rule.

When I originally developed this, I did some testing on WP Engine and that's when I discovered that some hosts wouldn't route URLs with file extensions through WordPress. SatisPress will automatically add an external rule https://github.com/cedaro/satispress/blob/aca49486c7f5e1a35b9c9184392c3ab1297e8efc/src/Provider/RewriteRules.php#L70-L85 in .htaccess to account for this, but I haven't tested with their new Web Rules Engine since they deprecated .htaccess support. If you're on WP Engine that might be something to look into as well.

— Reply to this email directly, view it on GitHub https://github.com/cedaro/satispress/issues/193#issuecomment-1292654677, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWNG6YMQTRGOCDJWTUZE3ODWFGMVTANCNFSM6AAAAAARPJ4Q4Q . You are receiving this because you authored the thread.Message ID: @.***>

bradyvercher commented 1 year ago

@adam-vanbuskirk Glad you were able to get this resolved quickly and thanks for following up!